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
Crash after calling fork in a process, using embedded firebird library [CORE3632] #3984
Comments
Modified by: @AlexPeshkoffassignee: Alexander Peshkov [ alexpeshkoff ] |
Commented by: @AlexPeshkoff Please provide details: |
Modified by: Kim Pedersen (kkp_tpl)Attachment: firebird.log [ 12017 ] |
Commented by: Kim Pedersen (kkp_tpl) 1. Classic |
Commented by: @AlexPeshkoff One more question - are you using events? |
Commented by: Kim Pedersen (kkp_tpl) No. |
Commented by: @AlexPeshkoff FYI. |
Commented by: Kim Pedersen (kkp_tpl) Ok, then it must have something to do with system shutdown. I discovered what was causing the error in my environment: First of all a database connection must be made. After that the following code will trigger the error: if ( fork() == 0 ) { It must have something to do with the duplication of the process and exiting the child afterwards.. |
Commented by: @AlexPeshkoff Well, now it's getting clear why does this happen. |
Commented by: Kim Pedersen (kkp_tpl) OK. |
Commented by: Damyan Ivanov (dam) A forked child inherits its state from the parent. This includes any database connections and lock manager state (if linked with libfbembed). There is no way to tell the library to forget everything it knows after a fork, is it? |
Commented by: @AlexPeshkoff Currently no. |
Commented by: @AlexPeshkoff And yes - in the case of missing DB connections the issue is harmless. |
Commented by: Kim Pedersen (kkp_tpl) I'm sorry I can't answer your questions regarding fork (I'm not that experienced in Linux). |
Commented by: @AlexPeshkoff I already know the method, it's pthread_atfork(). So the main question is - are you using embedded or TCP connections? |
Commented by: Kim Pedersen (kkp_tpl) We connect to the database using localhost:/db/database.fdb. We have our application running on Firebird since 2004 and we have used version 1.5, 2.0, 2.1 and now 2.5. We never saw this error before and we never had any problems or data corruption. But maybe we can't be sure of that anymore, because of major changes in the database engine.. |
Commented by: @AlexPeshkoff Feel safe - when started with localhost:, theis is not embedded, but TCP connection. |
Commented by: Kim Pedersen (kkp_tpl) Ok, thanks. |
Modified by: @AlexPeshkoffsummary: pthread_join failed => Crash after calling fork in a process, using embedded firebird library |
Commented by: @AlexPeshkoff First of all must notice that due to (sooner of all) changes in glibc issue is not reproducible any more directly - system calls exec*() now do not invoke destructors of global variables. But this does not help in a case when for some reason exec() fails and child process has to exit after printing error. |
Modified by: @AlexPeshkoffstatus: Open [ 1 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: 3.0 Beta 2 [ 10586 ] |
Commented by: @AlexPeshkoff Test case |
Modified by: @AlexPeshkoffAttachment: fork.cpp [ 12652 ] |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Modified by: @pavel-zotovQA Status: No test |
Modified by: @pavel-zotovstatus: Closed [ 6 ] => Closed [ 6 ] QA Status: No test => Cannot be tested |
Submitted by: Kim Pedersen (kkp_tpl)
Attachments:
firebird.log
fork.cpp
Now and then Firebird add the following to /opt/firebird/firebird.log:
Operating system call pthread_join failed. Error code 22.
It happens after I upgraded one of our production servers to Firebird 2.5.1 (it ran 2.3.1 before that).
Everything seems to work ok, but something might be wrong because of this error.
Commits: f641886 c14a121 FirebirdSQL/fbt-repository@8957b91 FirebirdSQL/fbt-repository@fdf5c5e
The text was updated successfully, but these errors were encountered: