-
Notifications
You must be signed in to change notification settings - Fork 0
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
WIP: Prevent race condition around strerror which is not thread safe #4
base: unstable
Are you sure you want to change the base?
Conversation
update from master
2f6bb45
to
c04e543
Compare
The compile time checks might need some additional tuning - verified on Linux & OSX but not beyond that.
c04e543
to
825ac5b
Compare
@oranagra an alternative approach to (#3) as @yossigo suggested. biggest pains in this approach are:
If you think this is a better approach, let me know and I'll work on getting it ready.... |
@ushachar The simplest approach which would just work on any recent glibc system would be to just use More esoteric platforms (OSX?) could have a compatibility function that handles this manually. |
@yossigo At least according to the man page, %m uses strerror (not strerror_r)
|
@ushachar seems like the manpage might not be accurate and |
i'm having hard time to tell which approach i prefer. The one in #3 seems easier to use in all the places that log an errno, but the solution is more complicated architecture (e.g. i.e the usage optins are these: the i'm leaning towards #3 being better because it's nicer in all the places that use it. |
@oranagra why? if we leave aside the implementation (i.e. we do that ourselves and don't depend on glibc), how about: serverLogError(LL_WARNING, errno, "Fatal error loading DB: %m, exiting."); |
@yossigo that's similar in my eyes to the one we already have in this PR. but keep in mind that you'll have to mess with the format string, some some prints can look like this: serverLogError(LL_WARNING, errno, "Fatal db %d error: %m, exiting %s.", dbid, "now"); if we bother that much to mess with the format string, maybe we can also move the errno from being first argument and just use: serverLog(LL_WARNING, "Fatal db %d error: %m, exiting %s.", dbid, errno, "now"); i.e. modify that normal |
The amount of code we'll need to write & maintain to re-implement a glibc independent %m is substantially larger (and more complex) then the code needed for #3 -- do you think it's worth it? |
@oranagra / @yossigo -- I see three options:
I tend to favor option 1, but 2 also seems very reasonable. |
i also prefer option 1 (#3). keeps the messy code in one place, and leaves the rest of the project relatively similar to how it was (compared to this PR). |
@yossigo - strong objection on your side for option 1? |
@ushachar I don't like option 1, a bit too much of a code smell. |
The compile time checks might need some additional tuning - verified on Linux & OSX but not beyond that.