-
-
Notifications
You must be signed in to change notification settings - Fork 362
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
Leftover logfile is close()d … unpredictably? #39
Comments
Have you tried _IOLBF ? The line buffer should correspond nicely to the line-at-a-time log entries, when you use two contexts at the same time.
|
This is the workaround that I have in place in my calling code. It seems to fix this particular issue, yes. :) There seems to be a related problem, where anything that depends on the global
I’ve not analyzed the code enough to determine if this causes “real” breakage. |
Not really "real" breakage, apart from a global variable. At least I think that is what happens. |
Thanks for the report, the fix is for the unpredictable close, and does not address the global variable use. That is for debug. |
Thank you! |
* nlnet/master: (22 commits) Nicer spelling and layout. - For NLnetLabs#45, check that 127.0.0.1 and ::1 are not used in unbound.conf when do-not-query-localhost is turned on, or at default on, unbound-checkconf prints a warning if it is found in forward-addr or stub-addr statements. - Fix memleak in unit test, reported from the clang 8.0 static analyzer. - Fix python dict reference and double free in config. - Merge PR NLnetLabs#6: Python module: support multiple instances - Merge PR NLnetLabs#5: Python module: define constant MODULE_RESTART_NEXT - Merge PR NLnetLabs#4: Python module: assign something useful to the per-query data store 'qdata' Noted in Changelog. - Added documentation to the ipset files (for doxygen output). - make depend - Fix to make unbound-control with ipset, remove unused variable, use unsigned type because of comparison, and assign null instead of compare with it. Remade lex and yacc output. - PR NLnetLabs#28: IPSet module, by Kevin Chou. Created a module to support the ipset that could add the domain's ip to a list easily. Needs libmnl, and --enable-ipset and config it, doc/README.ipset.md. - Fix to omit RRSIGs from addition to the ipset. - Fix for NLnetLabs#24: Fix abort due to scan of auth zone masters using old address from previous scan. - Fix NLnetLabs#39: In libunbound, leftover logfile is close()d unpredictably. - Master contains version 1.9.3 in development. fix segmentation fault rollback the code bugfix performance improvement edit config parser to support ipset Add support for ipset Document how to configure multiple python modules Support multiple python module instances ...
The above code illustrates a problem where a 2nd context creation will clobber a leftover logfile from a former context.
It seems like the ideal fix would be to put the log state variables into the context struct rather than having them be globals?
(I haven’t tested it, but it looks like, given the globals, it would be problematic, for example, to have two concurrent Unbound objects in the same process with different log outputs?)
Failing that change … is there any way to fix this, short of removing that fclose() in log.c (and potentially breaking behavior that implementations may have been expecting now for over 10 years)?
Regardless, it seems like this issue should at least be documented? The existing libunbound(3) documentation for ub_ctx_debugout() gives the impression that log state is contained entirely within the log object, which of course isn’t the case.
The workaround seems to be to set the log handle to stderr before deleting the context … does that seem reasonable?
Thank you!
The text was updated successfully, but these errors were encountered: