After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 59305 - Hang on URL/MIME part open with --enable-threads
Hang on URL/MIME part open with --enable-threads
Status: VERIFIED INCOMPLETE
Product: balsa
Classification: Other
Component: general
1.2.x
Other Linux
: Normal normal
: ---
Assigned To: Balsa Maintainers
Balsa Maintainers
: 59391 (view as bug list)
Depends on: 59002
Blocks:
 
 
Reported: 2001-08-21 09:37 UTC by Toralf Lund
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Work-around (4.79 KB, patch)
2001-08-21 09:39 UTC, Toralf Lund
none Details | Review
Proposed patch (1.34 KB, patch)
2001-08-21 16:28 UTC, Pawel Salek
none Details | Review
The previous patch was not reliable. This one is better. (1.12 KB, patch)
2001-08-21 16:45 UTC, Pawel Salek
none Details | Review
Alternative approach: Add fork handler in threads_init() (694 bytes, patch)
2001-08-22 09:16 UTC, Toralf Lund
none Details | Review
Alternative approach - I (896 bytes, patch)
2001-08-22 09:35 UTC, Pawel Salek
none Details | Review
Debug trace from hanging process (7.40 KB, text/plain)
2001-08-22 10:49 UTC, Toralf Lund
  Details
url-test.c - testing program (2.53 KB, text/plain)
2001-08-23 07:53 UTC, Pawel Salek
  Details

Description Toralf Lund 2001-08-21 09:37:59 UTC
Balsa built with --enable-threads will hang when a highlighted URL is
opened, or "view part with..." is selected for an URL. The hang occurs
within gnome_execute_async(), which is in turn called by
gnome_execute_shell() and gnome_url_show().

On closer inspection, it looks like there is a problem with the "exec"
functions. For instance, process calling exec...("gnome-moz-remote") will
never return, even though gnome-moz-remote exits immediately. When the same
 command is started via system(), everything looks OK, though.

The patch that will be attached shows a possible workaround, and should
also pinpoint the problem. It contains modified versions of functions
ingnome-exec.c and gnome-url.c from gnome-libs.
Comment 1 Toralf Lund 2001-08-21 09:39:14 UTC
Created attachment 921 [details] [review]
Work-around
Comment 2 Toralf Lund 2001-08-21 09:42:23 UTC
"for an URL" in the 2nd line of the description should of course be
replaced with "for a message part" or similar... 

Comment 3 Pawel Salek 2001-08-21 16:28:21 UTC
Created attachment 927 [details] [review]
Proposed patch
Comment 4 Pawel Salek 2001-08-21 16:45:54 UTC
Created attachment 928 [details] [review]
The previous patch was not reliable. This one is better.
Comment 5 Toralf Lund 2001-08-22 07:21:22 UTC
Ah. That [referring to patch] makes a lot of sense, of course.
Although I guess the gnome_exec... functions ought do something like
this, really. Or isn't libgnome expected to be thread safe?

Anyhow, let me just remind you that similar logic is probably needed
for gnome_execute_shell(), too. Also, perhaps these routines should be
moved to libbalsa, as they are needed in other files for one of my own
hacks at least.
Comment 6 Pawel Salek 2001-08-22 07:25:14 UTC
Your comments are valid. 

BTW, we have discussed this last night GMT at balsa-list, and this is
not quite good approach: the handlers are added each time URL is
clicked. The handlers should be registered only once. A new patch is
needed.
Comment 7 Toralf Lund 2001-08-22 09:16:29 UTC
Created attachment 929 [details] [review]
Alternative approach: Add fork handler in threads_init()
Comment 8 Toralf Lund 2001-08-22 09:24:06 UTC
How about simply [please consider my last patch]? The beauty of this
is that _nothing_ else has to be changed. I wasn't able to find any
side effects, either, but I may have missed something.

And now for the bad news: This patch does not resolve the problem for
me, neither does the previous one. In fact, I can't see any
indications that the fork handler is called at all for the gnome_...
functions. I tried debugging a bit to figure out what was going on,
but wasn't very successful as gdb got rather confused...
Comment 9 Pawel Salek 2001-08-22 09:35:22 UTC
Created attachment 932 [details] [review]
Alternative approach - I
Comment 10 Pawel Salek 2001-08-22 09:37:56 UTC
Your patch seemed ok apart from trying to unlock mutt without being
sure it is locked. What about the attached version? Does it solve your
problem?
Comment 11 Pawel Salek 2001-08-22 09:49:15 UTC
One should also lock and unlock mailbox_lock mutex. 
It would be helpful to detect which mutex hangs balsa.
Comment 12 Toralf Lund 2001-08-22 10:48:15 UTC
No, the last patch doesn't help, either. After paying around a bit
with some other code that will execute an external app (my HMTL
converter, refer to Bug 58915) I'm convinced that the fork handlers
are NOT called on normal fork(). They are, however, if I replace
fork()+exec...() with system().

I'll also attach some debug trace that shows where the hang occurs,
although I'm not sure if it's very helpful.
Comment 13 Toralf Lund 2001-08-22 10:49:39 UTC
Created attachment 933 [details]
Debug trace from hanging process
Comment 14 Pawel Salek 2001-08-23 07:51:49 UTC
I attach simple testing program. The funny thing is, it is sufficient
to create void thread to create this hang. IMO, gnome_exec_async has a
serious bug. I am going to forward it to gnome-libs team.
Comment 15 Pawel Salek 2001-08-23 07:53:38 UTC
Created attachment 941 [details]
url-test.c - testing program
Comment 16 Pawel Salek 2001-08-24 23:27:44 UTC
This is believed to be solved in current CVS (2001-08-25) (at least I
cannot reproduce it any more). Confirmation would be apprectiated.
Comment 17 Carlos Morgado 2001-08-30 22:26:44 UTC
*** Bug 59391 has been marked as a duplicate of this bug. ***
Comment 18 Toralf Lund 2001-08-31 08:49:27 UTC
Works for me now.
Comment 19 Pawel Salek 2001-08-31 08:50:22 UTC
I am happy to close this report :-)