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
segfault at 58 ip 00007f95d54ddabd sp 00007f95c5ba50f0 error 4 in libpython2.7.so.1.0 #408
Comments
FreeRADIUS version? Python sub version? |
Python 2.7.3, radiusd: FreeRADIUS Version 2.2.1, for host x86_64-unknown-linux-gnu, built on Aug 20 2013 at 15:37:04 |
What other information do you need? First time post core dump. |
Is it reproducible easily? Does it occur when running single threaded? |
Well I have no idea what's going on, it's occurring deep inside the python code. |
Not easily reproducible, played only under load. On the stand mode radiusd-X does not play. How else can I help? |
radiusd: FreeRADIUS Version 2.2.0. No such problems, months are running under load. |
Sorry, this bug will be fixed? |
It's not clear why it's happening. It seems like it's the result of improper locking, but the current scheme being used should work, unless there's some additional python magic i've missed. The TLS macros are new as well so there could be a bug in those. Unfortunately there are three different flavours so it's difficult to test them all on one platform. Could you add: RDEBUG("New threadstate %p", (void *) my_thread_state); Just above: if (!my_thread_state) { (Line 416 rlm_python.c) rebuild and run the server with The number of messages should equal the initial starting size of your thread pool, and you not increase on subsequent requests unless the server is under load. The address should change each time as well. |
Sorry, there must be so?
|
So should write to the log [python] New threadstate (nil)? |
On 22 Aug 2013, at 17:00, avdoshkin notifications@github.com wrote:
Sorry that should be above if (!my_thread_state)
|
if (worker) { |
No... Just use this. gstate = PyGILState_Ensure();
if (worker) {
PyThreadState *my_thread_state;
my_thread_state = fr_thread_local_init(local_thread_state, do_python_cleanup);
if (!my_thread_state) {
my_thread_state = PyThreadState_New(inst->main_thread_state->interp);
RDEBUG("New threadstate %p", (void *) my_thread_state);
if (!my_thread_state) {
radlog(L_ERR, "Failed initialising local PyThreadState on first run");
PyGILState_Release(gstate);
return RLM_MODULE_FAIL;
}
ret = fr_thread_local_set(local_thread_state, my_thread_state);
if (ret != 0) {
radlog(L_ERR, "Failed storing PyThreadState in TLS: %s", strerror(ret));
PyThreadState_Clear(my_thread_state);
PyThreadState_Delete(my_thread_state);
PyGILState_Release(gstate);
return RLM_MODULE_FAIL;
}
}
RDEBUG("Using threadstate %p", (void *) my_thread_state);
prev_thread_state = PyThreadState_Swap(my_thread_state); /* Swap in our local thread state */
} |
What else to do to find the error? |
You've given me GDB logs but not the logs from the server... As the error occurs within the python code, and as the thread state is not on the stack at the time, they are useless. I need the logs from the server itself... |
mixed up the name. |
I can help with something else? |
OK. That debug output is helpful. You notice the thread state is the same for every request? I would expect that to change. It's probably the pthread variant of TLS (or more, the wrappers around it). Could you edit
to
Then:
This should enable compiler support for TLS instead of relying on pthread. If this works, then it would appear to be a bug in the |
Now do, always happy to help! |
In file https://github.com/FreeRADIUS/freeradius-server/blob/v2.x.x/src/include/autoconf.h.in /* Define if the compiler supports __thread */ changed to: ok? |
On 23 Aug 2013, at 15:15, Igor Avdoshkin notifications@github.com wrote:
No, src/include/autoconf.h autoconf.h will only appear after you have run ./configure |
Good! |
Sorry, you're with someone of the city and the country? |
I didn't understand your question. If you're using a translator please post the message in your original language as well. |
В какой стране живете? |
After the hotfix is working freeradius, wait for the night, in the morning we'll see. |
Excellent. :) and England. |
sdtout - https://docs.google.com/file/d/0B4dvafHHhRrWTVdWVlplR1pyX1E/edit?usp=sharing |
Ideas for solving the problem will be? |
What's odd is the thread state is still the same. I have some holiday time today, so i'll look at this myself. |
Good! How will I test? |
On 26 Aug 2013, at 10:37, Igor Avdoshkin notifications@github.com wrote:
I really doubt it's a product of being used as a DHCP server. There were some modifications in between 2.2.0 and current HEAD to support the equivalent of thread local storage within Python and they're probably what's causing the issue. I can send parallel requests which will probably trigger the issue sooner. -Arran |
When I test your ideas? |
When I have some code. Seeing as I had to work through my holiday, I guess it won't be today. You are welcome to try and tackle the problem in the interim. |
Hi! What's new found in the code? |
Temporary fix is in v2.x.x branch now. |
Hi! Check? |
On 16 Sep 2013, at 17:09, Igor Avdoshkin notifications@github.com wrote:
Yes, thanks. |
On a production server modules(python,dhcp) running! |
Cool thanks for the feedback :) |
Seems to be fixed. |
No, it's not. |
It was 'fixed' by setting the THREAD_UNSAFE flag, the underlying cause isn't clear. |
The text was updated successfully, but these errors were encountered: