Skip to content
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

Segfault (when compiled with GDC) #109

Closed
Infiltrator opened this issue Sep 4, 2013 · 5 comments
Closed

Segfault (when compiled with GDC) #109

Infiltrator opened this issue Sep 4, 2013 · 5 comments

Comments

@Infiltrator
Copy link

Segfault leaving dub at source/dub/utils.d:100.

gdb run output below.

$ gdb dub
GNU gdb (GDB) 7.6 (Debian 7.6-5)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/user/projects/dub/bin/dub...done.
(gdb) r -v
Starting program: /home/user/projects/dub/bin/dub -v
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Using dub registry url 'http://code.dlang.org/'
Looking for local package map at /var/lib/dub/packages/
Looking for local package map at /home/user/.dub/packages/
Looking for local package map at /var/lib/dub/packages/
Looking for local package map at /home/user/.dub/packages/
Looking for local package map at /var/lib/dub/packages/
Looking for local package map at /home/user/.dub/packages/
Looking for local package map at /var/lib/dub/packages/
Looking for local package map at /home/user/.dub/packages/
Determined package version using GIT: diqs ~develop
Collecting dependencies for diqs
Found dependency vibe-d ~master: false
Checking dependencies in '/home/user/projects/diqs'
dub initialized
Fechting package vibe-d (1 suppliers registered)
Fechting package libevent (1 suppliers registered)
Fechting package openssl (1 suppliers registered)
Fechting package libev (1 suppliers registered)
Triggering installation of required package 'libevent', which is not installed.
Triggering installation of required package 'vibe-d', which is not installed.
Triggering installation of required package 'openssl', which is not installed.
Triggering installation of required package 'libev', which is not installed.
The following changes will be performed:
Install libevent ~master, userWide
Install vibe-d ~master, userWide
Install openssl ~master, userWide
Install libev ~master, userWide
Downloading libevent ~master...
Acquiring package zip file
Found download URL: 'http://code.dlang.org/packages/libevent/~master.zip'
Trying to curl.download(http://code.dlang.org/packages/libevent/~master.zip, /tmp/libevent-master.zip, HTTP(RefCounted!(Impl)(RefCountedStore(95D650))))

Program received signal SIGSEGV, Segmentation fault.
0x00000000005ef08d in std.net.curl.HTTP.onReceiveHeader.__lambda33 (
    this=<optimized out>, header=...)
    at ../../../../gcc-4.8-20130808/libphobos/src/std/net/curl.d:2581
2581                            p.onReceiveStatusLine(p.status);
(gdb) bt
#0  0x00000000005ef08d in std.net.curl.HTTP.onReceiveHeader.__lambda33 (
    this=<optimized out>, header=...)
    at ../../../../gcc-4.8-20130808/libphobos/src/std/net/curl.d:2581
#1  0x00000000005e896e in std.net.curl.Curl.onReceiveHeader.__lambda36 (
    this=0x7ffff7ee9520, od=...)
    at ../../../../gcc-4.8-20130808/libphobos/src/std/net/curl.d:3666
#2  0x00000000005e57f8 in std.net.curl.Curl._receiveHeaderCallback() (
    str=<optimized out>, size=<optimized out>, nmemb=<optimized out>,
    ptr=<optimized out>)
    at ../../../../gcc-4.8-20130808/libphobos/src/std/net/curl.d:3851
#3  0x00007ffff7b8cf36 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
#4  0x00007ffff7b8b545 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
#5  0x00007ffff7ba0782 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
#6  0x00007ffff7ba2077 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
#7  0x00000000005ec3d8 in std.net.curl.Curl.perform (throwOnError=true,
    this=...) at ../../../../gcc-4.8-20130808/libphobos/src/std/net/curl.d:3599
#8  std.net.curl.HTTP._perform() (this=..., throwOnError=true)
    at ../../../../gcc-4.8-20130808/libphobos/src/std/net/curl.d:2143
#9  0x000000000048c365 in std.net.curl.__T8downloadTS3std3net4curl4HTTPZ.downloa---Type <return> to continue, or q <return> to quit---
d() (url=..., saveToPath=..., conn=...)
    at /opt/gdc/include/d/4.8.2/std/net/curl.d:263
#10 0x0000000000440878 in dub.utils.download() (url=..., filename=...)
    at source/dub/utils.d:100
#11 0x0000000000440909 in dub.utils.download() (url=..., filename=...)
    at source/dub/utils.d:105
#12 0x000000000042813e in dub.packagesupplier.RegistryPackageSupplier.retrievePackage() (this=..., path=..., packageId=..., dep=...)
    at source/dub/packagesupplier.d:104
#13 0x000000000041b1c6 in dub.dub.Dub.install() (this=..., packageId=...,
    dep=..., location=1) at source/dub/dub.d:217
#14 0x000000000041a1de in dub.dub.Dub.update() (this=..., options=0)
    at source/dub/dub.d:151
#15 0x000000000040a2a7 in D main (args=...) at source/app.d:238
#16 0x000000000056ac0f in rt.dmain2._d_run_main.runMain (this=0x7fffffffde80)
    at ../../../../gcc-4.8-20130808/libphobos/libdruntime/rt/dmain2.d:620
#17 0x000000000056b36f in rt.dmain2._d_run_main() (
    this=this@entry=0x7fffffffde80, dg=...)
    at ../../../../gcc-4.8-20130808/libphobos/libdruntime/rt/dmain2.d:595
#18 0x000000000056b5a0 in rt.dmain2._d_run_main.runAll (this=0x7fffffffde80)
    at ../../../../gcc-4.8-20130808/libphobos/libdruntime/rt/dmain2.d:630
#19 0x000000000056b36f in rt.dmain2._d_run_main() (
    this=this@entry=0x7fffffffde80, dg=...)
---Type <return> to continue, or q <return> to quit---
    at ../../../../gcc-4.8-20130808/libphobos/libdruntime/rt/dmain2.d:595
#20 0x000000000056b508 in _d_run_main (argc=2, argv=<optimized out>,
    mainFunc=<optimized out>)
    at ../../../../gcc-4.8-20130808/libphobos/libdruntime/rt/dmain2.d:639
#21 0x00007ffff6eb4995 in __libc_start_main (main=0x56b540 <main>, argc=2,
    ubp_av=0x7fffffffdfc8, init=<optimized out>, fini=<optimized out>,
    rtld_fini=<optimized out>, stack_end=0x7fffffffdfb8) at libc-start.c:260
#22 0x0000000000407983 in _start ()
(gdb) q
A debugging session is active.

        Inferior 1 [process 25794] will be killed.

Quit anyway? (y or n) y
@s-ludwig
Copy link
Member

Tough to judge, but taking into account how the std.net.curl interface works I'd say this is probably more of a Phobos bug than a DUB bug. Does it always occur or just sporadically? Which DMD version was used to compile DUB?

@jpf91
Copy link

jpf91 commented Dec 7, 2013

Likely a bug in std.net.curl which is hidden in DMD because of NRVO. It's a rather nasty stack corruption issue, see http://forum.dlang.org/thread/[email protected] . I have a fix for std.net.curl which I'll send to phobos today and I'll probably backport it to gdc. It's not a dub bug though.

@s-ludwig
Copy link
Member

s-ludwig commented Dec 8, 2013

Can anyone confirm that it works on GDC now? I've verified it for LDC, so it should also be fine for GDC.

@jpf91 Thanks a lot for investigating this!

@jpf91
Copy link

jpf91 commented Dec 8, 2013

With those changes it's working on GDC as well :-)

@s-ludwig
Copy link
Member

(Sorry, this browser tag kind of got lost under a heap load of others) Thanks for the confirmation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants