Closed abhilashsajeev closed 1 year ago
We already have panic recovering and graceful shutdown handling. For autorestart you can setup a systemd service as shown in https://pocketbase.io/docs/going-to-production/#systemd-service.
Could you provide more information when you are experiencing this error? What is your PocketBase version? Do you use PocketBase as framework or the prebuilt executable?
@ganigeorgiev My pocketbase version is 0.10.4. Specific situation of crash is not yet identified. but the last logs before crash is given above. it shows fatal error: concurrent map iteration and map write
I'm not sure how to reproduce it.
The only way I can think this error could occur is if there is a log write in the process and the server was abruptly stopped/killed for some reason (eg. in case of OOM).
FireAndForget
is generally called for 2 reasons:
If you manage to narrow down the cause of the error, please let me know and I'll try to investigate it in more details.
But in any case, it is recommended to create a systemd service to keep the process up and restart on its own if needed.
You can also temporary enable the debug mode with --debug
.
Another possibility for the error could be also if you have custom Go code that modifies a models.Record
concurrently or in a OnRecordAfterRequestVerificationRequest
/OnRecordAfterRequestPasswordResetRequest
hook since it runs concurrently with the FireAndForget
(I may eventually consider adding a mutex to the models.Record
in the next release).
Just for info if anyone is following here, the models.Record
data and expand operations should be now concurrent safe in the latest v0.12.0 release.
Our pocket base crashes some times with log
How to prevent this and enable graceful restarts