-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Improve dlerror message reporting #11488
Conversation
I think this is the most important change, and should be uncontroversial. Will help greatly in situations like #11374 where the user gives a known-good absolute path and needs to see the real error message. I think the other changes are correct and hopefully an improvement, but last time we messed with this code it broke a bunch of stuff so I'm counting on a thorough review... (cc @garrison to make sure I didn't inadvertently re-introduce any leaks) |
@quinnj thanks for the pointer. Maybe, but I doubt it. That kind of looks like some freaky i/o thing to me because part of the message after |
- for absolute paths, show the error message if file exists. this way users always get diagnostics when they try a known path. - for DL_LOAD_PATH/DL_EXT permutations: if a file exists, show error. these paths should be complete by construction (ie, include extension). if dlopen fails and the file exists, best to let the user know. - when throwing an error, first print the dlerror, then free the handle, then throw the error. this is not idea, but is the simplest way I can think of to actually show the error without leaking the errmsg. - free the handle before throwing an error on Windows also add some comments.
Improve dlerror message reporting
I didn't comment, but this looked good to me. This got me curious why the second argument to |
It's incorrect for dlopen to bail on a valid file that can't be used with dlopen. It must finish the search before giving up entirely. At this point we should really just drop our pretensions of using the uv_lib API and just fully embrace that we have been wrapping dlopen directly. |
We're only talking about paths here (either absolute, or by construction), not the fallback case. But there are some problematic cases such as:
The first could be handled by always trying the the +extension version first. The second could be handled by removing the blank extension case so that we only ever try
Agreed. Might mean a little bit more work on Windows, but seems like a good idea overall. I don't think that would affect the question of dlerror reporting, though. |
I guess I'm coming around to your suggestion in the other thread. If we fully emulate the dlopen search order (trying |
This PR replaces #7940. The goal is to improve error reporting for dlopen errors, as since #10832 we free the dlerror message in all code paths, before throwing a (Julia) error. Thus we only show
no error
even after failures.(whereas before we almost exclusively showed the frequently-incorrect
no such file
message, but with a rare useful error message if the failure was on the very last file tried).this way users always get diagnostics when they try a known
path.
error. these paths should be complete by construction (i.o.w.
includes extension). if dlopen fails and the file exists,
best to let the user know.
handle, then throw the error. this is not ideal, but is the
simplest way I can think of to actually show the dlerror without
leaking the errmsg.
also add some comments.