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 #13

Closed
cjohansen opened this issue Apr 9, 2011 · 12 comments
Closed

Segfault #13

cjohansen opened this issue Apr 9, 2011 · 12 comments

Comments

@cjohansen
Copy link

require("glob").glob("*/.js", function (err, paths) {})

[1] 6330 segmentation fault node

@isaacs
Copy link
Owner

isaacs commented Apr 11, 2011

  1. what version of glob are you using?
  2. what operating system?
  3. what version of node?
  4. I'm pretty sure */.js is not going to match anything. Sure you didn't mean *.js?

@cjohansen
Copy link
Author

🤦 Sorry for the noob bug report.

  1. 2.0.6
  2. Linux Mint (Ubuntu 10.10)
  3. 0.4.0
  4. Hmm, think Github mangled my pattern. */.js is meaningless, and it doesn't trigger the segfault. The pattern I tried was **/*.js

@isaacs
Copy link
Owner

isaacs commented Apr 13, 2011

Ok, cool. See if the problem goes away by upgrading node to 0.4.5 (it might).

I'm going to port glob to be just in js soon. It won't be quite as fast, but it will be way more stable and portable that way.

@cjohansen
Copy link
Author

Still have the problem on node 0.4.5. It's interesting; it really doesn't want that pattern - glob("./**/*.js") also segfaults, while somedir/**/*.js does not.

Porting to JavaScript: +1 :)

@isaacs
Copy link
Owner

isaacs commented Apr 13, 2011

You could maybe do path.resolve("./**/*.js") then, in the meantime.

If you could run it in gdb, I'd love a stack trace. Otherwise closing this for now.

@isaacs isaacs closed this as completed Apr 13, 2011
@cjohansen
Copy link
Author

If you want to tell a gdb noob how, and I'd love to help :)

Interestingly, the path.resolve approach also segfaults. Maybe it just hates my directory? :)

@isaacs
Copy link
Owner

isaacs commented Apr 13, 2011

echo 'require("glob").glob("./**/*.js", function (er, paths) { console.error(er, paths) })' > g.js
gdb node
# in gdb:
set args g.js
run

The "help" command is helpful :)

@cjohansen
Copy link
Author

Heh, seems this bug report is here to make me look bad... Sorry.

Reading symbols from /home/christian/local/bin/node...done.
(gdb) set args g.js
(gdb) run
Starting program: /home/christian/local/bin/node g.js
[Thread debugging using libthread_db enabled]
[New Thread 0x7fffd1f42700 (LWP 8183)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffd1f42700 (LWP 8183)]
0x00007fffd1f4a16b in g_lstat (fn=0x0, sb=0x0, pglob=0x0) at ../deps/glob/glob.c:1156
1156 {

@isaacs
Copy link
Owner

isaacs commented Apr 13, 2011

Ah, right, so, at that point, do this:

(gdb) backtrace

I can repro this on my linux box (was missing something obvious before). Here's what I'm seeing:

#0  0x00007fffd1f9a4d1 in g_lstat (fn=0x0, sb=0x0, pglob=0x0) at ../deps/glob/glob.c:1156
#1  0x00007fffd1f998e8 in glob3 (pathbuf=0x7ffff7e18e40, pathend=0x7ffff7e18e8e, pathlim=0x7ffff7e1ae40, pattern=0x7ffff7e1ae9a, restpattern=0x7ffff7e1aea2, 
    pglobstar=0x7ffff7e1aea2, pglob=0xc16490, limit=0x7ffff7e1ef60) at ../deps/glob/glob.c:827
#2  0x00007fffd1f99652 in glob2 (pathbuf=0x7ffff7e18e40, pathend=0x7ffff7e18e8e, pathlim=0x7ffff7e1ae40, pattern=0x7ffff7e1ae9a, pglob=0xc16490, 
    limit=0x7ffff7e1ef60) at ../deps/glob/glob.c:766
#3  0x00007fffd1f9983f in glob3 (pathbuf=0x7ffff7e18e40, pathend=0x7ffff7e18e8e, pathlim=0x7ffff7e1ae40, pattern=0x7ffff7e1ae94, restpattern=0x7ffff7e1ae98, 
    pglobstar=0x7ffff7e1ae94, pglob=0xc16490, limit=0x7ffff7e1ef60) at ../deps/glob/glob.c:821
#4  0x00007fffd1f99652 in glob2 (pathbuf=0x7ffff7e18e40, pathend=0x7ffff7e18e8e, pathlim=0x7ffff7e1ae40, pattern=0x7ffff7e1ae94, pglob=0xc16490, 
    limit=0x7ffff7e1ef60) at ../deps/glob/glob.c:766
#5  0x00007fffd1f99d26 in glob3 (pathbuf=0x7ffff7e18e40, pathend=0x7ffff7e18e7c, pathlim=0x7ffff7e1ae40, pattern=0x7ffff7e1ae94, restpattern=0x7ffff7e1ae98, 
    pglobstar=0x7ffff7e1ae94, pglob=0xc16490, limit=0x7ffff7e1ef60) at ../deps/glob/glob.c:931
#6  0x00007fffd1f99652 in glob2 (pathbuf=0x7ffff7e18e40, pathend=0x7ffff7e18e7c, pathlim=0x7ffff7e1ae40, pattern=0x7ffff7e1ae94, pglob=0xc16490, 
    limit=0x7ffff7e1ef60) at ../deps/glob/glob.c:766
#7  0x00007fffd1f99d26 in glob3 (pathbuf=0x7ffff7e18e40, pathend=0x7ffff7e18e74, pathlim=0x7ffff7e1ae40, pattern=0x7ffff7e1ae94, restpattern=0x7ffff7e1ae98, 
    pglobstar=0x7ffff7e1ae94, pglob=0xc16490, limit=0x7ffff7e1ef60) at ../deps/glob/glob.c:931
#8  0x00007fffd1f99652 in glob2 (pathbuf=0x7ffff7e18e40, pathend=0x7ffff7e18e74, pathlim=0x7ffff7e1ae40, pattern=0x7ffff7e1ae94, pglob=0xc16490, 
    limit=0x7ffff7e1ef60) at ../deps/glob/glob.c:766
#9  0x00007fffd1f99d26 in glob3 (pathbuf=0x7ffff7e18e40, pathend=0x7ffff7e18e64, pathlim=0x7ffff7e1ae40, pattern=0x7ffff7e1ae94, restpattern=0x7ffff7e1ae98, 
    pglobstar=0x7ffff7e1ae94, pglob=0xc16490, limit=0x7ffff7e1ef60) at ../deps/glob/glob.c:931
#10 0x00007fffd1f99652 in glob2 (pathbuf=0x7ffff7e18e40, pathend=0x7ffff7e18e64, pathlim=0x7ffff7e1ae40, pattern=0x7ffff7e1ae94, pglob=0xc16490, 
    limit=0x7ffff7e1ef60) at ../deps/glob/glob.c:766
#11 0x00007fffd1f99d26 in glob3 (pathbuf=0x7ffff7e18e40, pathend=0x7ffff7e18e58, pathlim=0x7ffff7e1ae40, pattern=0x7ffff7e1ae94, restpattern=0x7ffff7e1ae98, 
    pglobstar=0x7ffff7e1ae94, pglob=0xc16490, limit=0x7ffff7e1ef60) at ../deps/glob/glob.c:931
#12 0x00007fffd1f99652 in glob2 (pathbuf=0x7ffff7e18e40, pathend=0x7ffff7e18e58, pathlim=0x7ffff7e1ae40, pattern=0x7ffff7e1ae94, pglob=0xc16490, 
    limit=0x7ffff7e1ef60) at ../deps/glob/glob.c:766
#13 0x00007fffd1f99d26 in glob3 (pathbuf=0x7ffff7e18e40, pathend=0x7ffff7e18e44, pathlim=0x7ffff7e1ae40, pattern=0x7ffff7e1ae94, restpattern=0x7ffff7e1ae98, 
    pglobstar=0x7ffff7e1ae94, pglob=0xc16490, limit=0x7ffff7e1ef60) at ../deps/glob/glob.c:931
#14 0x00007fffd1f99652 in glob2 (pathbuf=0x7ffff7e18e40, pathend=0x7ffff7e18e44, pathlim=0x7ffff7e1ae40, pattern=0x7ffff7e1ae94, pglob=0xc16490, 
    limit=0x7ffff7e1ef60) at ../deps/glob/glob.c:766
#15 0x00007fffd1f991ea in glob1 (pattern=0x7ffff7e1ae90, pglob=0xc16490, limit=0x7ffff7e1ef60) at ../deps/glob/glob.c:670
#16 0x00007fffd1f99063 in glob0 (pattern=0x7ffff7e1cf50, pglob=0xc16490, limit=0x7ffff7e1ef60) at ../deps/glob/glob.c:616
#17 0x00007fffd1f98697 in globexp1 (pattern=0x7ffff7e1cf50, pglob=0xc16490, limit=0x7ffff7e1ef60) at ../deps/glob/glob.c:333
#18 0x00007fffd1f985aa in myglob (pattern=0xbe46c8 "./**/*.js", flags=33920, errfunc=0, pglob=0xc16490) at ../deps/glob/glob.c:306
#19 0x00007fffd1f97269 in EIO_Glob (req=0xc164f0) at ../src/glob.cc:86
#20 0x0000000000542890 in eio_execute (thr_arg=<value optimized out>) at ../deps/libeio/eio.c:1826
#21 etp_proc (thr_arg=<value optimized out>) at ../deps/libeio/eio.c:1635
#22 0x00007ffff683aa04 in start_thread () from /lib/libpthread.so.0
#23 0x00007ffff65a3d4d in clone () from /lib/libc.so.6
#24 0x0000000000000000 in ?? ()

@isaacs isaacs reopened this Apr 13, 2011
@isaacs
Copy link
Owner

isaacs commented Apr 13, 2011

Yeah, solution is just to write this in JS.

@cjohansen
Copy link
Author

Cool. Thanks for being so helpful!

@isaacs
Copy link
Owner

isaacs commented Oct 3, 2011

Will be solved by #23

@isaacs isaacs closed this as completed Oct 3, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants