unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Sheheryar Parvaz <skipper308@hotmail.ca>
To: 30261@debbugs.gnu.org
Subject: bug#30261: segfault on simultaneous initialization
Date: Fri, 26 Jan 2018 17:24:11 +0000	[thread overview]
Message-ID: <DM5PR13MB159629F5A5A3B229022C7AD4F1E00@DM5PR13MB1596.namprd13.prod.outlook.com> (raw)

[-- 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 --]

             reply	other threads:[~2018-01-26 17:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-26 17:24 Sheheryar Parvaz [this message]
2018-01-26 23:41 ` bug#30261: segfault on simultaneous initialization Mark H Weaver
2018-01-27  0:58   ` Sheheryar Parvaz
2018-01-27 20:27     ` Mark H Weaver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM5PR13MB159629F5A5A3B229022C7AD4F1E00@DM5PR13MB1596.namprd13.prod.outlook.com \
    --to=skipper308@hotmail.ca \
    --cc=30261@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).