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
Error codes should be expanded to string representations #1123
Comments
What does your Blin command look like to recreate this? |
@jeffythedragonslayer I don't think you'll be able to reproduce it now, and it doesn't really matter. The point is that it'll be more useful to have readable error messages rather than error codes. Line 171 in 8e078a2
|
Ok, I usually try to recreate bugs I want to fix so I can see the difference before-and-after that my fix works, is all. |
@jeffythedragonslayer but, if you want to reproduce something like this: echo 1000 > /proc/sys/kernel/threads-max # limit the max num of threads to some small number
perl6 -e 'loop { say $++; Thread.start(sub { sleep β }); }' Result:
There you go :) |
Ok, this looks like an easy one so long as we are sure the types of errors that cause memory leaks from uv_strerrorrs don't happen, but idk. |
It seems to me that the correct thing to do, if an unknown error occurs, is to call uv__free(void*) on the char* returned by uv_strerrors, since those "Unknown system error" strings are dynamically allocated. For known errors, in uv_strerrors the macroexpansion of UV_ERRNO_MAP(UV_STRERROR_GEN) is a big list of string literals (which probably are statically initialized in .rodata) so those can't leak. Perhaps we should just test whether the returned string begins with "Unknown system error" and if so, free it after printing. |
There is uv_error_r if you want to avoid leaking |
Example here:
MoarVM/src/core/threads.c
Line 171 in 8e078a2
The error message appeared during Blin run:
However, it's hard to tell what -11 is.
Seems like all you have to do is call uv_strerror or similar function (docs).
The text was updated successfully, but these errors were encountered: