-
Notifications
You must be signed in to change notification settings - Fork 328
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
devdraw: GUI programs hang on AIX #398
Comments
How to debug:
Thanks. |
Ok, here's what we have running:
I assume you want the (devdraw) process. On AIX, we have only have dbx, not gdb. But here we go:
Just for some more info, and curiosity, lets see what the other two are up to...
And PID 10354924:
I hope that provides some helpful information! |
dbx is showing the same stack for all the threads, so it's unfortunately not too helpful. There's only one thread with that particular stack (mouse._ioproc), I'm sure. One stab in the dark would be to try
before starting sam. |
That may also have been an artifact of dbx not behaving the way I expected.
devdraw (PID 19005588):
PID 20185276:
PID 17694836:
Hopefully that's a little better... |
Sorry for the delayed response. I don't understand the thread t1 that is stuck "running" in _string. Maybe it is in an infinite loop of some kind. It is in a loop calling cachechars but it is supposed to make progress on each iteration. Maybe add some debugging prints inside _string or at the top of cachechars to see what the calls look like? |
Sorry for leaving this hanging for so long.
I run sam again and get the following output repeated forever:
Adding a print after the call to cachechars indicates that it always returns 0 each time as well. Perhaps not a thread issue after all? Thank you! |
This is interesting. I think the problem is with cachechars returning 0.
When I run sam, cachechars returns 1 a few times, but as soon as I right-click or type a character, I just get endless "cachechars returning: 0". |
I did some more digging, comparing a step-by-step run on Linux against a step-by-step on AIX, and tracked the issue down to src/libdraw/string.c:80:
For example, if I start sam, attach a debugger to the samterm process, and set a breakpoint on cachechars, and then type "a" in the sam window, I can see that we end up calling cachechars twice. The second call is for our "a". This call works correctly, and in cachechars sp gets incremented by the value of w, which is 1 in this case. Now, *sp = "". On Linux, we get to the while statement above, and the statement evaluates to false and we move on to line 146:
On AIX, the statement evaluates to true and we enter the loop. Now we end up passing garbage arguments to cachechars and it always returns 0 and we end up looping forever. The following change to string.c resolves the issue for AIX, but causes a segfault on other platforms:
Not sure this is the best way to resolve this, but something like this seems to be a solution that allows AIX to work without breaking anything anywhere else:
I will submit a pull request with this change. |
On AIX, devdraw seems to hang any time it would draw a character on the screen. This occurs in any program that uses devdraw, including src/libdraw/test.c. In sam, the hang can be triggered by typing a character in the command window, or displaying the menu. Upon right-clicking, the following is displayed:
I enabled some of the debugging statements in devdraw and libdraw, and I can see that the window still responds to mouse position events, window resizes, and even receives character input, but only a limited quantity after. Approximately 3-4 additional keyboard events get processed before devdraw totally locks up and stops responding to any events.
This has always been an issue on AIX, but I haven’t been very interested in the GUI programs until recently.
I could use some intuition as to if this sounds like a problem with the font code, X11 draw code, or perhaps even libthread.
The text was updated successfully, but these errors were encountered: