unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#30261: segfault on simultaneous initialization
@ 2018-01-26 17:24 Sheheryar Parvaz
  2018-01-26 23:41 ` Mark H Weaver
  0 siblings, 1 reply; 4+ messages in thread
From: Sheheryar Parvaz @ 2018-01-26 17:24 UTC (permalink / raw)
  To: 30261

[-- Attachment #1: Type: text/plain, Size: 1392 bytes --]

If the initial call to scm_with_guile is on a thread and in the main
thread at the same time, a segmentation fault occurs.

    #include <pthread.h>
    #include <libguile.h>

    void* hello_world(void *arg) {
        scm_c_eval_string("(display \"Hello World!\")");
        scm_c_eval_string("(newline)");
    }

    void run_guile() {
        scm_with_guile(&hello_world, NULL);
    }

    int main(int argc, char **argv) {

        pthread_t th;
        int ret = pthread_create(&th, NULL, &run_guile, NULL);

        run_guile();
        pthread_join(&th, NULL);

        return 0;
    }

Here is a backtrace of the issue.

    #0  0x00007ffff7afd976 in scm_set_current_dynamic_state () from /usr/lib/libguile-2.2.so.1
    #1  0x00007ffff7b5faec in guilify_self_2 () from /usr/lib/libguile-2.2.so.1
    #2  0x00007ffff7b604b4 in scm_i_init_thread_for_guile () from /usr/lib/libguile-2.2.so.1
    #3  0x00007ffff7b604f9 in with_guile () from /usr/lib/libguile-2.2.so.1
    #4  0x00007ffff7281312 in GC_call_with_stack_base () from /usr/lib/libgc.so.1
    #5  0x00007ffff7b60918 in scm_with_guile () from /usr/lib/libguile-2.2.so.1
    #6  0x00000000004007a3 in run_guile ()
    #7  0x00007ffff7893568 in start_thread (arg=0x7ffff5ea8700) at pthread_create.c:465
    #8  0x00007ffff75cb52f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95


[-- Attachment #2: Type: text/html, Size: 2823 bytes --]

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

end of thread, other threads:[~2018-01-27 20:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-26 17:24 bug#30261: segfault on simultaneous initialization Sheheryar Parvaz
2018-01-26 23:41 ` Mark H Weaver
2018-01-27  0:58   ` Sheheryar Parvaz
2018-01-27 20:27     ` Mark H Weaver

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).