Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal error: concurrent map writes #456

Closed
piotrekkr opened this issue Jan 4, 2024 · 6 comments
Closed

fatal error: concurrent map writes #456

piotrekkr opened this issue Jan 4, 2024 · 6 comments

Comments

@piotrekkr
Copy link

Hello. I'm using frankenphp image as base and I'm trying to start my container with this command:

CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile" ]

My /etc/caddy/Caddyfile inside container looks like this:

{
    auto_https off

    frankenphp {
        worker {
            file /var/www/public/index.php
            num {$FRANKENPHP_WORKERS_NUM}
            env APP_RUNTIME "Runtime\FrankenPhpSymfony\Runtime"
        }
    }
    # https://caddyserver.com/docs/caddyfile/directives#sorting-algorithm
    order mercure after encode
    order vulcain after reverse_proxy
    order php_server before file_server
    order php before file_server
}

http://localhost:8080 {
    root * /var/www/public

    php_server
}

Cannot start container because of this:

pricing-app-1  | [INFO] Executing container command
pricing-app-1  | {"level":"info","ts":1704388242.7557049,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
pricing-app-1  | {"level":"warn","ts":1704388242.7565336,"msg":"Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":2}
pricing-app-1  | {"level":"info","ts":1704388242.7571924,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//[::1]:2019","//127.0.0.1:2019","//localhost:2019"]}
pricing-app-1  | {"level":"warn","ts":1704388242.7572942,"logger":"http.auto_https","msg":"automatic HTTPS is completely disabled for server","server_name":"srv0"}
pricing-app-1  | {"level":"info","ts":1704388242.7573664,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0004a8f80"}
pricing-app-1  | {"level":"info","ts":1704388242.7575421,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
pricing-app-1  | fatal error: concurrent map writes

Any idea how to fix this? Thanks

@withinboredom
Copy link
Collaborator

You probably need #452 which may not be released yet... ??? @dunglas

What version of frankenphp are you using? frankenphp --version

@piotrekkr
Copy link
Author

I'm using dunglas/frankenphp:1.0.2-php8.2.13-bookworm as a base image. Update description. Thanks

@piotrekkr
Copy link
Author

@withinboredom So as a workaround I could set this env var on container level and there should be no race condition this way? Am I right?

@withinboredom
Copy link
Collaborator

Yep, that should work! I'd actually suggest using the sha-7830aae-* tags as a base image until 1.0.3 tag is released, as there is also a major memory leak fix in there #366. I suspect there won't be another merge into main before 1.0.3 is released (or at the very least, maybe documentation updates).

@dunglas
Copy link
Owner

dunglas commented Jan 4, 2024

I won't have a good internet connection until Sunday. I'll do the release as soon as a I get proper internet.

@piotrekkr
Copy link
Author

Yep, that should work! I'd actually suggest using the sha-7830aae-* tags as a base image until 1.0.3 tag is released, as there is also a major memory leak fix in there #366. I suspect there won't be another merge into main before 1.0.3 is released (or at the very least, maybe documentation updates).

@withinboredom Okay just tested this and this workaround worked 🎉 Also thanks for this trick with SHA in docker tags. Did not know it was latest versions from main branch.

@dunglas Thanks. Will wait for release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants