-
Notifications
You must be signed in to change notification settings - Fork 70
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
OS_LibShutdown is not called #32
Comments
See pull request #33 |
i'not sure is usefull to do that, because is call in FCGIexit only when exit. in FCGX_Accept is calling FCGX_Init only if libInitialized is initialized... only at the first request... if you call at every FCGX_Finish you force at each FCGX_Accept to reinit at each Accept... and os init activate the signal handler and i'm not sure they are correctly coded to reenabled at each accept... |
I can confirm the initial analysis. I'm getting this with Valgrind on my app running on embedded Linux with spawn-fcgi:
The code in
|
but FCGX_Accept is calling FCGX_Init only if libInitialized is initialized... in fcgiapp.c :
only one time along the live of the process... |
IMO executing It would be great if |
FCGIexit is for that i think... they call OS_LibShutdown().... |
FCGIexit does call OS_LibShutdown, but it also terminates the process when calling exit(). It would be great to have a similar function in declared in fcgiapp.h that returns a code without exiting the process. In my case, I'm using fcgi in a side library along my main process, I am not creating a process for it. |
What is the current status of this topic? I agree to have |
On my side, I decided to fix it by freeing the memory manually :
This implies to include I am not sure this issue can have an easy fix. I understand that my commit could cause some regression. I suggest the issue remains open with this hack. Here is an example https://gitlab.com/louson.fr/grav/-/blob/master/pages/03.papers/connect-your-firmware-with-fastcgi/fcgi-server.c |
normaly FCGX_Finish free the request data at fcgiapp.c:2045 but leave the connection open if request->keepConnection are true (depend on the FCGI_KEEP_CONN flag send from fcgi server).
effectively the OS_LibShutdown are exposed by this include at fcgios.h:104 and possibly can be called explicitly in that way.
FCGIexit must be used in place of exit() is there role. if fact idealy is to call FCGIexit event if the exit status are 0 (you must call FCGIexit(0) in this case), in this case OS_LibShutdown are systematicly call before exit. Normaly you need to call OS_LibShutdown only before exit of the process. is the way is developped... but effectively if you need to use in side library, you must call explicitly OS_LibShutdown in using fcgios.h include. but you can call it at library shutdown to avoid to reinit each time. |
In unix at least :
fcgiapp has a call to OS_LibInit() that allocates a structure (asyncIoTable) which is never freed.
I guess OS_LibShutdown should be called in FCGX_Finish().
The text was updated successfully, but these errors were encountered: