unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#29275: dynamic-link hangs on error
@ 2017-11-12 18:16 noxdafox
  2017-11-22 15:47 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: noxdafox @ 2017-11-12 18:16 UTC (permalink / raw)
  To: 29275

Greetings,

I am trying to call some C function which seems not to be included in 
Guile library (fnmatch).

If dynamic-link is given wrong library objects, it will hang forcing the 
user to kill the VM as it becomes unresponsive.

I could find at least 2 ways to reproduce it:

1. Calling dynamic-link on a wrong object

2. Calling dynamic-link subsequently on 2 non existing objects

Here's an example:

GNU Guile 2.2.2
Copyright (C) 1995-2017 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (use-modules (system foreign))
scheme@(guile-user)> (define libc-obj (dynamic-link "nonexisting"))
ERROR: In procedure dynamic-link:
ERROR: In procedure dynamic-link: file: "nonexisting", message: "file 
not found"

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> (define libc-obj (dynamic-link "nonexisting"))

^^^ here the VM becomes unresponsive.







^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#29275: dynamic-link hangs on error
  2017-11-12 18:16 bug#29275: dynamic-link hangs on error noxdafox
@ 2017-11-22 15:47 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2017-11-22 15:47 UTC (permalink / raw)
  To: noxdafox; +Cc: 29275-done

Hello,

noxdafox <noxdafox@gmail.com> skribis:

> GNU Guile 2.2.2
> Copyright (C) 1995-2017 Free Software Foundation, Inc.
>
> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
> This program is free software, and you are welcome to redistribute it
> under certain conditions; type `,show c' for details.
>
> Enter `,help' for help.
> scheme@(guile-user)> (use-modules (system foreign))
> scheme@(guile-user)> (define libc-obj (dynamic-link "nonexisting"))
> ERROR: In procedure dynamic-link:
> ERROR: In procedure dynamic-link: file: "nonexisting", message: "file
> not found"
>
> Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
> scheme@(guile-user) [1]> (define libc-obj (dynamic-link "nonexisting"))
>
> ^^^ here the VM becomes unresponsive.

This is because libguile synchronizes uses of ‘dynamic-link’ with a
non-recursive mutex.  Here, the “inner” ‘dynamic-link’ call occurs while
the mutex is already held by the calling thread, which is why it just
hangs.

Fixed in commit 48d42553ef5a9c2240bc2296d1b38dbfd5fca1ac, which will be
in the next 2.2 release.

Thanks,
Ludo’.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-22 15:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-12 18:16 bug#29275: dynamic-link hangs on error noxdafox
2017-11-22 15:47 ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).