Export to GitHub

phantomjs - issue #694

segfault on page.uploadFile()


Posted on Aug 5, 2012 by Happy Rabbit

version 1.6.1 (built it myself with ./build.sh), on arch linux 64bit.

i can consistently reproduce a segfault with this file: testcase.js: var system = require('system'); var page = new WebPage();

var url = system.args[1]; var input_name = system.args[2]; var file_path = system.args[3];

page.open(url, function (status) { if (status !== "success") { console.log('OPEN_ERROR', 'unable to open ', url); } else { page.uploadFile('input[name='+input_name+']', file_path); } });

gdb session: simple-black-box ❯ gdb phantomjs GNU gdb (GDB) 7.4.1 Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html&gt; 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-unknown-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/&gt;... Reading symbols from /usr/bin/phantomjs...(no debugging symbols found)...done. (gdb) run testcase.js http://localhost:8080 file_selector /tmp/tmp.pEZuQAMJss Starting program: /usr/bin/phantomjs testcase.js http://localhost:8080 file_selector /tmp/tmp.pEZuQAMJss warning: Could not load shared library symbols for linux-vdso.so.1. Do you need "set solib-search-path" or "set sysroot"? no [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/libthread_db.so.1". Traceback (most recent call last): File "/usr/share/gdb/auto-load/usr/lib/libgobject-2.0.so.0.3200.4-gdb.py", line 9, in <module> from gobject import register File "/usr/share/glib-2.0/gdb/gobject.py", line 3, in <module> import gdb.backtrace ImportError: No module named backtrace [New Thread 0x7ffff0f0b700 (LWP 13759)] [New Thread 0x7ffff060a700 (LWP 13760)] [New Thread 0x7fffef386700 (LWP 13761)] [New Thread 0x7fffa7fff700 (LWP 13763)]

Program received signal SIGSEGV, Segmentation fault. QIODevice::read (this=this@entry=0x0, data=0x99fb78 "", maxSize=maxSize@entry=16384) at io/qiodevice.cpp:769 769 Q_D(QIODevice); (gdb) no (gdb) bt

0 ?? () at io/qiodevice.cpp:769

1 0x00007ffff4e118fe in ?? ()

2 0x00007ffff6e9e0ac in ?? ()

3 0x000000000099fb60 in ?? ()

4 0x0000000000000000 in ?? ()

(gdb)

Comment #1

Posted on Aug 5, 2012 by Happy Rabbit

commenting the page.uploadFile() stops the segfault from happening.

Comment #2

Posted on Aug 10, 2012 by Happy Rabbit

I just noticed apparently I had debug symbols disabled. I recompiled and made sure both phantomjs as its qt dependencies have debug symbols enabled, and this is the new output, unfortunately not much clearer:

simple-black-box ❯ gdb phantomjs GNU gdb (GDB) 7.4.1 Copyright (C) 2012 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-unknown-linux-gnu". For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... Reading symbols from /usr/bin/phantomjs...done. (gdb) run testcase.js http://localhost:8080 file_selector /home/dieter/tabula_V14nomast.mp3 Starting program: /usr/bin/phantomjs testcase.js http://localhost:8080 file_selector /home/dieter/tabula_V14nomast.mp3 warning: Could not load shared library symbols for linux-vdso.so.1. Do you need "set solib-search-path" or "set sysroot"? no [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/libthread_db.so.1". Traceback (most recent call last): File "/usr/share/gdb/auto-load/usr/lib/libgobject-2.0.so.0.3200.4-gdb.py", line 9, in from gobject import register File "/usr/share/glib-2.0/gdb/gobject.py", line 3, in import gdb.backtrace ImportError: No module named backtrace [New Thread 0x7ffff0f0b700 (LWP 18624)] [New Thread 0x7ffff060a700 (LWP 18625)] [New Thread 0x7fffef386700 (LWP 18627)] [New Thread 0x7fffa7fff700 (LWP 18628)]

Program received signal SIGSEGV, Segmentation fault. QIODevice::read (this=this@entry=0x0, data=0x9b9b68 "", maxSize=maxSize@entry=16384) at io/qiodevice.cpp:769 769 Q_D(QIODevice); (gdb) no (gdb) bt

0 ?? () at io/qiodevice.cpp:769

1 0x00007ffff4e118fe in ?? ()

2 0x00007ffff6e9e0ac in ?? ()

3 0x00000000009b9b50 in ?? ()

4 0x0000000000000000 in ?? ()

(gdb)

Comment #3

Posted on Mar 8, 2013 by Quick Camel

I have the same problem with using Poltergeist and PhantomJS 1.8.2 installed from Homebrew on Mac OS X ML 10.8.2. In my case but it happens randomly.

Comment #4

Posted on Mar 16, 2013 by Happy Horse

Closing. This issue has been moved to GitHub: https://github.com/ariya/phantomjs/issues/10694

Status: Migrated

Labels:
Type-Defect Priority-Medium