Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Linux Prebuilt Binary Failure Behavior for require with Bad Path #14132

Closed
localnerve opened this issue Mar 24, 2016 · 13 comments
Closed

Linux Prebuilt Binary Failure Behavior for require with Bad Path #14132

localnerve opened this issue Mar 24, 2016 · 13 comments

Comments

@localnerve
Copy link

I'm trying to upgrade to Phantomjs 2.x and found a behavior I'm not understanding.

Using the Linux prebuilt binary, on Ubuntu 14.04.4, calling require from a Phantomjs script with a bad path causes the entire system to get so busy that it becomes unresponsive.

Tried both Macosx binary and Linux binary - The prebuilt Macosx binary fails nicely.

Any help understanding the root cause is greatly appreciated.

@vitallium
Copy link
Collaborator

Hi.

Could you please elaborate the bad path? Is it non-existent path? Or does it have invalid symbols? Or something else.

And post the output from PhantomJS with --debug=yes option.

Thanks.

@localnerve
Copy link
Author

I test two "bad paths":

  1. totally undefined
  2. non-existent file (well-formed)

Both cause the machine to become non-responsive (big red button only). Since the machine must be physically rebooted at that point, each trial to narrow this down also does (no input possible). I'll not (or likely not) be able to get any output from phantomJS (or be able to persist/retrieve any output).

@zackw
Copy link
Contributor

zackw commented Mar 24, 2016

Here is something else to try. Make sure the strace utility is installed, then run this shell script, passing it the path to the offending PhantomJS binary:

#! /bin/sh

script=`mktemp -t test.XXXXXX.js`
trap "rm -f '$script'" 0
cat >"$script" <<\EOF
require("/nonexistent/absolute/path/req.js")
phantom.exit(0)
EOF

(while :; do sleep 1; sync; done) &
syncer="$!"
trap "kill -9 '-$syncer'; rm -f '$script'" 0

strace -f -tt -o trace.log "$1" "$script" &
pid="$!"
sleep 5
kill -15 -"$pid"
sleep 1
kill -9 -"$pid"
wait

This should be able to recover control after the bug manifests, unless we're actually looking at a kernel bug here; but it also attempts to make sure that the output hits the disk, so if you do have to hit the big red button, trace.log might still be meaningful.

If this works, trace.log will be very large. Save the entire thing, but post only the last 100 lines or so. I expect those 100 lines to be quite repetitive.

@zackw
Copy link
Contributor

zackw commented Mar 24, 2016

Also, please give concrete examples of what you mean by "totally undefined" and "non-existent file (well-formed)" pathname.

(As far as the operating system is concerned, there is no such thing as an ill-formed pathname. Any byte sequence that's a valid C-string, and fits under some large and arbitrary length limit, is acceptable as input to the open system call, and could refer to a file that exists.)

@localnerve
Copy link
Author

I'm still preparing your script for test/recovery (thank you!).
In the meantime, here's the concrete examples (these are used to test the dependent module behavior with bad input):

  1. "totally undefined", meaning phantomjs javascript references a javascript property that was omitted by the user.
  2. "./bogus/file.txt", a file which actually does not exist on the filesystem, used here, and referenced by the same phantomjs javascript.

@zackw
Copy link
Contributor

zackw commented Mar 24, 2016

I just realized that there was a bug in my script. Do this instead:

#! /bin/sh

script=`mktemp -t test.XXXXXX.js`
trap "rm -f '$script'" 0
cat >"$script" <<\EOF
require("/nonexistent/absolute/path/req.js")
phantom.exit(0)
EOF

(while :; do sleep 1; sync; done) &
syncer="$!"
trap "kill -9 '-$syncer'; rm -f '$script'" 0

strace -f -tt -o trace.log "$1" "$script" &
pid="$!"
sleep 5
kill -15 -"$pid"
sleep 1
kill -9 -"$pid"
wait "$pid"

The only change is on the last line, which needs to be wait "$pid" instead of wait.

FYI, this is what happens when I try to reproduce the problem in my environment:

$ ./bin/phantomjs 
phantomjs> require('/nonexistent/foo.js')
Cannot find module '/nonexistent/foo.js'

  phantomjs://repl-input:1 in global code
phantomjs> require(undefined);
'require(undefined);' is a cyclic structure

  phantomjs://repl-input:1 in global code

That's using a local build of development trunk, not the prebuilt binary, but it oughtn't matter.

@zackw zackw closed this as completed Mar 24, 2016
@zackw zackw reopened this Mar 24, 2016
@ariya ariya closed this as completed Mar 24, 2016
@zackw
Copy link
Contributor

zackw commented Mar 24, 2016

oops, pushed the wrong button

@zackw
Copy link
Contributor

zackw commented Mar 24, 2016

@ariya Did you mean to close this one?

@ariya ariya reopened this Mar 24, 2016
@ariya
Copy link
Owner

ariya commented Mar 24, 2016

@zackw No, I was confused as well.

@localnerve
Copy link
Author

OK, ran it. Two sections here, command output and trace.log output.

Command output

I waited for a minute and ^C'd the process since it didn't kill properly.

agrant@bitbuckler:~/src/localnerve/html-snapshots$ ./gh-test.sh ~/src/localnerve/html-snapshots/node_modules/.bin/phantomjs
Error: Cannot find module '/nonexistent/absolute/path/req.js'

  phantomjs://platform/bootstrap.js:299 in require
  phantomjs://platform/bootstrap.js:263 in require
./gh-test.sh: 17: kill: No such process

./gh-test.sh: 19: kill: No such process


^C
agrant@bitbuckler:~/src/localnerve/html-snapshots$ ~/src/localnerve/html-snapshots/node_modules/.bin/phantomjs --version
2.1.1

Trace Log Output

Here's the last ~100 lines or so of the trace.log

5450  13:49:54.985578 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
5450  13:49:54.985659 ioctl(4, SIOCGIFHWADDR, {ifr_name="eth0", ifr_hwaddr=e0:69:95:25:81:88}) = 0
5450  13:49:54.985736 close(4)          = 0
5450  13:49:54.985820 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
5450  13:49:54.985892 ioctl(4, SIOCGIFHWADDR, {ifr_name="wlan0", ifr_hwaddr=48:5d:60:db:05:21}) = 0
5450  13:49:54.985960 close(4)          = 0
5450  13:49:54.986041 write(5, "\1\0\0\0\0\0\0\0", 8) = 8
5450  13:49:54.986129 socket(PF_NETLINK, SOCK_RAW, 0) = 4
5450  13:49:54.986236 bind(4, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 0
5450  13:49:54.986341 getsockname(4, {sa_family=AF_NETLINK, pid=5444, groups=00000000}, [12]) = 0
5450  13:49:54.986443 sendto(4, "\24\0\0\0\22\0\1\3\302(\364V\0\0\0\0\0\0\0\0", 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20
5450  13:49:54.986601 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"|\4\0\0\20\0\2\0\302(\364VD\25\0\0\0\0\4\3\1\0\0\0I\0\1\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 3452
5450  13:49:54.986731 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\24\0\0\0\3\0\2\0\302(\364VD\25\0\0\0\0\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 20
5450  13:49:54.986847 sendto(4, "\24\0\0\0\26\0\1\3\303(\364V\0\0\0\0\0\0\0\0", 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20
5450  13:49:54.986967 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"L\0\0\0\24\0\2\0\303(\364VD\25\0\0\2\10\200\376\1\0\0\0\10\0\1\0\177\0\0\1"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 164
5450  13:49:54.987092 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"H\0\0\0\24\0\2\0\303(\364VD\25\0\0\n\200\200\376\1\0\0\0\24\0\1\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 144
5450  13:49:54.987216 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\24\0\0\0\3\0\2\0\303(\364VD\25\0\0\0\0\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 20
5450  13:49:54.987340 close(4)          = 0
5450  13:49:54.987498 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
5450  13:49:54.987611 ioctl(4, SIOCGIFHWADDR, {ifr_name="eth0", ifr_hwaddr=e0:69:95:25:81:88}) = 0
5450  13:49:54.987741 close(4)          = 0
5450  13:49:54.987858 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
5450  13:49:54.987963 ioctl(4, SIOCGIFHWADDR, {ifr_name="wlan0", ifr_hwaddr=48:5d:60:db:05:21}) = 0
5450  13:49:54.988068 close(4)          = 0
5450  13:49:54.988193 pselect6(6, [5], [], [], {0, 0}, {NULL, 8}) = 1 (in [5], left {0, 0})
5450  13:49:54.988364 read(5, "\1\0\0\0\0\0\0\0", 8) = 8
5450  13:49:54.988477 write(3, "\1\0\0\0\0\0\0\0", 8) = 8
5450  13:49:54.988593 pselect6(6, [5], [], [], {9, 985000000}, {NULL, 8} <unfinished ...>
5444  13:49:54.988644 <... pselect6 resumed> ) = 1 (in [3], left {9, 985013075})
5444  13:49:54.988778 read(3, "\1\0\0\0\0\0\0\0", 8) = 8
5444  13:49:54.988995 pselect6(4, [3], [], [], {9, 985000000}, {NULL, 8}) = 0 (Timeout)
5444  13:50:04.978826 pselect6(4, [3], [], [], {0, 145000000}, {NULL, 8} <unfinished ...>
5450  13:50:04.983750 <... pselect6 resumed> ) = 0 (Timeout)
5450  13:50:04.983931 socket(PF_NETLINK, SOCK_RAW, 0) = 4
5450  13:50:04.984241 bind(4, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 0
5450  13:50:04.984491 getsockname(4, {sa_family=AF_NETLINK, pid=5444, groups=00000000}, [12]) = 0
5450  13:50:04.984688 sendto(4, "\24\0\0\0\22\0\1\3\314(\364V\0\0\0\0\0\0\0\0", 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20
5450  13:50:04.984963 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"|\4\0\0\20\0\2\0\314(\364VD\25\0\0\0\0\4\3\1\0\0\0I\0\1\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 3452
5450  13:50:04.985226 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\24\0\0\0\3\0\2\0\314(\364VD\25\0\0\0\0\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 20
5450  13:50:04.985370 sendto(4, "\24\0\0\0\26\0\1\3\315(\364V\0\0\0\0\0\0\0\0", 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20
5450  13:50:04.985448 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"L\0\0\0\24\0\2\0\315(\364VD\25\0\0\2\10\200\376\1\0\0\0\10\0\1\0\177\0\0\1"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 164
5450  13:50:04.985567 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"H\0\0\0\24\0\2\0\315(\364VD\25\0\0\n\200\200\376\1\0\0\0\24\0\1\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 144
5450  13:50:04.985681 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\24\0\0\0\3\0\2\0\315(\364VD\25\0\0\0\0\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 20
5450  13:50:04.985797 close(4)          = 0
5450  13:50:04.985984 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
5450  13:50:04.986085 ioctl(4, SIOCGIFHWADDR, {ifr_name="eth0", ifr_hwaddr=e0:69:95:25:81:88}) = 0
5450  13:50:04.986174 close(4)          = 0
5450  13:50:04.986276 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
5450  13:50:04.986352 ioctl(4, SIOCGIFHWADDR, {ifr_name="wlan0", ifr_hwaddr=48:5d:60:db:05:21}) = 0
5450  13:50:04.986427 close(4)          = 0
5450  13:50:04.986513 write(5, "\1\0\0\0\0\0\0\0", 8) = 8
5450  13:50:04.986609 socket(PF_NETLINK, SOCK_RAW, 0) = 4
5450  13:50:04.986681 bind(4, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 0
5450  13:50:04.986756 getsockname(4, {sa_family=AF_NETLINK, pid=5444, groups=00000000}, [12]) = 0
5450  13:50:04.986829 sendto(4, "\24\0\0\0\22\0\1\3\314(\364V\0\0\0\0\0\0\0\0", 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20
5450  13:50:04.986957 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"|\4\0\0\20\0\2\0\314(\364VD\25\0\0\0\0\4\3\1\0\0\0I\0\1\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 3452
5450  13:50:04.987052 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\24\0\0\0\3\0\2\0\314(\364VD\25\0\0\0\0\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 20
5450  13:50:04.987135 sendto(4, "\24\0\0\0\26\0\1\3\315(\364V\0\0\0\0\0\0\0\0", 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20
5450  13:50:04.987221 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"L\0\0\0\24\0\2\0\315(\364VD\25\0\0\2\10\200\376\1\0\0\0\10\0\1\0\177\0\0\1"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 164
5450  13:50:04.987332 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"H\0\0\0\24\0\2\0\315(\364VD\25\0\0\n\200\200\376\1\0\0\0\24\0\1\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 144
5450  13:50:04.987418 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\24\0\0\0\3\0\2\0\315(\364VD\25\0\0\0\0\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 20
5450  13:50:04.987507 close(4)          = 0
5450  13:50:04.987626 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
5450  13:50:04.987701 ioctl(4, SIOCGIFHWADDR, {ifr_name="eth0", ifr_hwaddr=e0:69:95:25:81:88}) = 0
5450  13:50:04.987773 close(4)          = 0
5450  13:50:04.987851 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
5450  13:50:04.987922 ioctl(4, SIOCGIFHWADDR, {ifr_name="wlan0", ifr_hwaddr=48:5d:60:db:05:21}) = 0
5450  13:50:04.987991 close(4)          = 0
5450  13:50:04.988076 pselect6(6, [5], [], [], {0, 0}, {NULL, 8}) = 1 (in [5], left {0, 0})
5450  13:50:04.988168 read(5, "\1\0\0\0\0\0\0\0", 8) = 8
5450  13:50:04.988246 write(3, "\1\0\0\0\0\0\0\0", 8) = 8
5444  13:50:04.988317 <... pselect6 resumed> ) = 1 (in [3], left {0, 135651680})
5450  13:50:04.988357 pselect6(6, [5], [], [], {9, 985000000}, {NULL, 8} <unfinished ...>
5444  13:50:04.988404 read(3, "\1\0\0\0\0\0\0\0", 8) = 8
5444  13:50:04.988509 pselect6(4, [3], [], [], {0, 135000000}, {NULL, 8}) = 0 (Timeout)
5444  13:50:05.123919 pselect6(4, [3], [], [], {0, 1000000}, {NULL, 8}) = 0 (Timeout)
5444  13:50:05.125192 pselect6(4, [3], [], [], {0, 0}, {NULL, 8}) = 0 (Timeout)
5444  13:50:05.125490 pselect6(4, [3], [], [], {0, 0}, {NULL, 8}) = 0 (Timeout)
5444  13:50:05.125821 pselect6(4, [3], [], [], {9, 848000000}, {NULL, 8} <unfinished ...>
5439  13:50:13.149889 <... epoll_wait resumed> 7fff65290c20, 1024, -1) = -1 EINTR (Interrupted system call)
5444  13:50:13.150010 <... pselect6 resumed> ) = ? ERESTARTNOHAND (To be restarted if no handler)
5439  13:50:13.150051 --- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
5444  13:50:13.150087 --- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
5439  13:50:13.150134 tgkill(5439, 5439, SIGINT) = 0
5449  13:50:13.150275 +++ killed by SIGINT +++
5454  13:50:13.150324 +++ killed by SIGINT +++
5453  13:50:13.150350 +++ killed by SIGINT +++
5452  13:50:13.150369 +++ killed by SIGINT +++
5451  13:50:13.150385 +++ killed by SIGINT +++
5439  13:50:13.150432 rt_sigreturn()    = -1 EINTR (Interrupted system call)
5439  13:50:13.150545 --- SIGINT {si_signo=SIGINT, si_code=SI_TKILL, si_pid=5439, si_uid=1000} ---
5440  13:50:13.150659 +++ killed by SIGINT +++
5447  13:50:13.150714 +++ killed by SIGINT +++
5448  13:50:13.150745 +++ killed by SIGINT +++
5445  13:50:13.150776 +++ killed by SIGINT +++
5443  13:50:13.150804 +++ killed by SIGINT +++
5442  13:50:13.150828 +++ killed by SIGINT +++
5441  13:50:13.150850 +++ killed by SIGINT +++
5446  13:50:13.152904 +++ killed by SIGINT +++
5439  13:50:13.152962 +++ killed by SIGINT +++
5450  13:50:13.153681 +++ killed by SIGINT +++
5444  13:50:13.153713 +++ killed by SIGINT +++

@localnerve
Copy link
Author

FWIW, here is what changing to undefined input looked like:

Command output

agrant@bitbuckler:~/src/localnerve/html-snapshots$ ./gh-test.sh ~/src/localnerve/html-snapshots/node_modules/.bin/phantomjs
TypeError: undefined is not an object (evaluating 'request[0]')

  phantomjs://platform/bootstrap.js:219 in _getPaths
  phantomjs://platform/bootstrap.js:248 in _getFilename
  phantomjs://platform/bootstrap.js:297 in require
  phantomjs://platform/bootstrap.js:263 in require
./gh-test.sh: 17: kill: No such process

./gh-test.sh: 19: kill: No such process

^C

Trace log output

I did not wait as long to ^C.

7822  14:05:26.709947 sched_yield( <unfinished ...>
7821  14:05:26.709955 sched_yield( <unfinished ...>
7822  14:05:26.709963 <... sched_yield resumed> ) = 0
7821  14:05:26.709971 <... sched_yield resumed> ) = 0
7822  14:05:26.709982 sched_yield( <unfinished ...>
7820  14:05:26.709991 sched_yield( <unfinished ...>
7812  14:05:26.710003 <... mmap resumed> ) = 0x7f1a2b4cf000
7820  14:05:26.710016 <... sched_yield resumed> ) = 0
7812  14:05:26.710029 madvise(0x7f1a2b4cf000, 126976, MADV_DONTNEED <unfinished ...>
7820  14:05:26.710042 sched_yield( <unfinished ...>
7812  14:05:26.710055 <... madvise resumed> ) = 0
7820  14:05:26.710067 <... sched_yield resumed> ) = 0
7812  14:05:26.710080 mprotect(0x7f1a2b4d0000, 65536, PROT_READ|PROT_WRITE <unfinished ...>
7820  14:05:26.710093 sched_yield( <unfinished ...>
7812  14:05:26.710105 <... mprotect resumed> ) = 0
7820  14:05:26.710117 <... sched_yield resumed> ) = 0
7812  14:05:26.710130 madvise(0x7f1a2b4d0000, 65536, MADV_WILLNEED <unfinished ...>
7820  14:05:26.710142 sched_yield( <unfinished ...>
7812  14:05:26.710163 <... madvise resumed> ) = 0
7820  14:05:26.710176 <... sched_yield resumed> ) = 0
7820  14:05:26.710205 sched_yield()     = 0
7820  14:05:26.710249 sched_yield()     = 0
7820  14:05:26.710294 futex(0x7f1a7d2c2c2c, FUTEX_WAIT_PRIVATE, 1, NULL <unfinished ...>
7812  14:05:26.710314 futex(0x7f1a7d2c2c2c, FUTEX_CMP_REQUEUE_PRIVATE, 1, 2147483647, 0x7f1a7d2c2c00, 2 <unfinished ...>
7820  14:05:26.710329 <... futex resumed> ) = -1 EAGAIN (Resource temporarily unavailable)
7812  14:05:26.710346 <... futex resumed> ) = 0
7820  14:05:26.710359 futex(0x7f1a7d2c2c00, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
7812  14:05:26.710372 futex(0x7f1a7d2c2c00, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7820  14:05:26.710384 <... futex resumed> ) = -1 EAGAIN (Resource temporarily unavailable)
7812  14:05:26.710398 <... futex resumed> ) = 0
7820  14:05:26.710410 futex(0x7f1a7d2c2c00, FUTEX_WAKE_PRIVATE, 1) = 0
7820  14:05:26.710452 futex(0x7f1a7d2c2c2c, FUTEX_WAIT_PRIVATE, 3, NULL <unfinished ...>
7812  14:05:26.710468 futex(0x7f1a7d2c2c2c, FUTEX_CMP_REQUEUE_PRIVATE, 1, 2147483647, 0x7f1a7d2c2c00, 4 <unfinished ...>
7820  14:05:26.710482 <... futex resumed> ) = -1 EAGAIN (Resource temporarily unavailable)
7812  14:05:26.710496 <... futex resumed> ) = 0
7820  14:05:26.710509 futex(0x7f1a7d2c2c00, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
7812  14:05:26.710522 futex(0x7f1a7d2c2c00, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7820  14:05:26.710535 <... futex resumed> ) = -1 EAGAIN (Resource temporarily unavailable)
7812  14:05:26.710548 <... futex resumed> ) = 0
7820  14:05:26.710561 futex(0x7f1a7d2c2c00, FUTEX_WAKE_PRIVATE, 1) = 0
7812  14:05:26.710587 futex(0x7f1a7d2c2c2c, FUTEX_WAIT_PRIVATE, 5, NULL <unfinished ...>
7820  14:05:26.710601 futex(0x7f1a7d2c2c2c, FUTEX_WAIT_PRIVATE, 6, NULL <unfinished ...>
7812  14:05:26.710615 <... futex resumed> ) = -1 EAGAIN (Resource temporarily unavailable)
7812  14:05:26.710636 futex(0x7f1a7d2c2c2c, FUTEX_WAIT_PRIVATE, 6, NULL <unfinished ...>
7822  14:05:26.711170 <... sched_yield resumed> ) = 0
7821  14:05:26.711191 futex(0x7f1a7d2c2c2c, FUTEX_WAIT_PRIVATE, 7, NULL <unfinished ...>
7822  14:05:26.711251 futex(0x7f1a7d2c2c2c, FUTEX_CMP_REQUEUE_PRIVATE, 1, 2147483647, 0x7f1a7d2c2c00, 10) = 3
7820  14:05:26.711284 <... futex resumed> ) = 0
7820  14:05:26.711308 futex(0x7f1a7d2c2c00, FUTEX_WAKE_PRIVATE, 1) = 1
7812  14:05:26.711344 <... futex resumed> ) = 0
7820  14:05:26.711363 sched_yield( <unfinished ...>
7812  14:05:26.711377 futex(0x7f1a7d2c2c00, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7822  14:05:26.711391 futex(0x7f1a7d2c2c2c, FUTEX_WAIT_PRIVATE, 11, NULL <unfinished ...>
7821  14:05:26.711404 <... futex resumed> ) = 0
7820  14:05:26.711413 <... sched_yield resumed> ) = 0
7821  14:05:26.711422 futex(0x7f1a7d2c2c00, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7820  14:05:26.711435 futex(0x7f1a7d2c2c28, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
7821  14:05:26.711445 <... futex resumed> ) = 0
7812  14:05:26.711457 <... futex resumed> ) = 1
7821  14:05:26.711466 futex(0x7f1a7d2c2c28, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7812  14:05:26.711479 futex(0x7f1a7d2c2c00, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
7821  14:05:26.711493 <... futex resumed> ) = 1
7820  14:05:26.711504 <... futex resumed> ) = 0
7821  14:05:26.711514 futex(0x7f1a7d2c2c2c, FUTEX_WAIT_PRIVATE, 12, NULL <unfinished ...>
7820  14:05:26.711526 futex(0x7f1a7d2c2c00, FUTEX_WAKE_PRIVATE, 1) = 1
7812  14:05:26.711554 <... futex resumed> ) = 0
7820  14:05:26.711567 futex(0x7f1a7d2c2c28, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7812  14:05:26.711577 futex(0x7f1a7d2c2c2c, FUTEX_CMP_REQUEUE_PRIVATE, 1, 2147483647, 0x7f1a7d2c2c00, 16 <unfinished ...>
7820  14:05:26.711589 <... futex resumed> ) = 0
7822  14:05:26.711598 <... futex resumed> ) = 0
7820  14:05:26.711610 futex(0x7f1a7d2c2c2c, FUTEX_WAIT_PRIVATE, 13, NULL <unfinished ...>
7822  14:05:26.711620 futex(0x7f1a7d2c2c00, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
7820  14:05:26.711631 <... futex resumed> ) = -1 EAGAIN (Resource temporarily unavailable)
7812  14:05:26.711650 <... futex resumed> ) = 2
7820  14:05:26.711663 futex(0x7f1a7d2c2c00, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
7812  14:05:26.711674 futex(0x7f1a7d2c2c00, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7820  14:05:26.711685 <... futex resumed> ) = -1 EAGAIN (Resource temporarily unavailable)
7821  14:05:26.711695 <... futex resumed> ) = 0
7820  14:05:26.711707 futex(0x7f1a7d2c2c00, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7821  14:05:26.711717 futex(0x7f1a7d2c2c28, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
7822  14:05:26.711730 <... futex resumed> ) = 0
7820  14:05:26.711739 <... futex resumed> ) = 1
7822  14:05:26.711747 futex(0x7f1a7d2c2c28, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
7820  14:05:26.711759 futex(0x7f1a7d2c2c28, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7822  14:05:26.711769 <... futex resumed> ) = -1 EAGAIN (Resource temporarily unavailable)
7821  14:05:26.711782 <... futex resumed> ) = 0
7822  14:05:26.711791 futex(0x7f1a7d2c2c00, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7821  14:05:26.711800 futex(0x7f1a7d2c2c28, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
7822  14:05:26.711808 <... futex resumed> ) = 0
7820  14:05:26.711816 <... futex resumed> ) = 1
7822  14:05:26.711824 futex(0x7f1a7d2c2c28, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7820  14:05:26.711836 futex(0x7f1a7d2c2c2c, FUTEX_WAIT_PRIVATE, 17, NULL <unfinished ...>
7822  14:05:26.711846 <... futex resumed> ) = 1
7821  14:05:26.711857 <... futex resumed> ) = 0
7822  14:05:26.711866 futex(0x7f1a7d2c2c2c, FUTEX_WAIT_PRIVATE, 18, NULL <unfinished ...>
7821  14:05:26.711875 futex(0x7f1a7d2c2c28, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7820  14:05:26.711883 <... futex resumed> ) = -1 EAGAIN (Resource temporarily unavailable)
7821  14:05:26.711892 <... futex resumed> ) = 0
7820  14:05:26.711903 futex(0x7f1a7d2c2c2c, FUTEX_WAIT_PRIVATE, 18, NULL <unfinished ...>
7821  14:05:26.711913 futex(0x7f1a7d2c2c00, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7812  14:05:26.711925 <... futex resumed> ) = 1
7821  14:05:26.711935 <... futex resumed> ) = 0
7821  14:05:26.712096 futex(0x7f1a7d2c2c28, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7812  14:05:26.712112 futex(0x7f1a7d2c2c28, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
7821  14:05:26.712202 <... futex resumed> ) = 0
7812  14:05:26.712218 <... futex resumed> ) = -1 EAGAIN (Resource temporarily unavailable)
7821  14:05:26.712228 futex(0x7f1a7d2c2c2c, FUTEX_WAIT_PRIVATE, 19, NULL <unfinished ...>
7812  14:05:26.712237 futex(0x7f1a7d2c2c28, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7821  14:05:26.712246 <... futex resumed> ) = -1 EAGAIN (Resource temporarily unavailable)
7812  14:05:26.712255 <... futex resumed> ) = 0
7821  14:05:26.712263 futex(0x7f1a7d2c2c00, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
7812  14:05:26.712271 futex(0x7f1a7d2c2c2c, FUTEX_CMP_REQUEUE_PRIVATE, 1, 2147483647, 0x7f1a7d2c2c00, 22 <unfinished ...>
7822  14:05:26.712295 <... futex resumed> ) = 0
7812  14:05:26.712321 <... futex resumed> ) = 2
7822  14:05:26.712336 futex(0x7f1a7d2c2c00, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
7812  14:05:26.712351 futex(0x7f1a7d2c2c00, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7822  14:05:26.712365 <... futex resumed> ) = -1 EAGAIN (Resource temporarily unavailable)
7812  14:05:26.712380 <... futex resumed> ) = 1
7822  14:05:26.712392 futex(0x7f1a7d2c2c00, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7812  14:05:26.712405 futex(0x7f1a7d2c2d44, FUTEX_WAIT_PRIVATE, 3, NULL <unfinished ...>
7822  14:05:26.712417 <... futex resumed> ) = 1
7820  14:05:26.712430 <... futex resumed> ) = 0
7822  14:05:26.712442 futex(0x7f1a7d2c2d14, FUTEX_WAIT_PRIVATE, 7, NULL <unfinished ...>
7820  14:05:26.712453 futex(0x7f1a7d2c2c00, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7821  14:05:26.712475 <... futex resumed> ) = 0
7820  14:05:26.712489 <... futex resumed> ) = 0
7821  14:05:26.712498 futex(0x7f1a7d2c2c00, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7820  14:05:26.712511 futex(0x7f1a7d2c2d14, FUTEX_WAIT_PRIVATE, 8, NULL <unfinished ...>
7821  14:05:26.712521 <... futex resumed> ) = 0
7821  14:05:26.712541 futex(0x7f1a7d2c2d44, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x7f1a7d2c2d40, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
7812  14:05:26.712589 <... futex resumed> ) = 0
7821  14:05:26.712609 futex(0x7f1a7d2c2d14, FUTEX_WAIT_PRIVATE, 9, NULL <unfinished ...>
7812  14:05:26.712624 futex(0x7f1a7d2c2ce8, FUTEX_WAKE_PRIVATE, 1) = 0
7812  14:05:26.712674 munmap(0x7f1a3800e000, 8192) = 0
7812  14:05:26.712760 futex(0x7f1a7d2ba234, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x7f1a7d2ba230, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1} <unfinished ...>
7819  14:05:26.712794 <... futex resumed> ) = 0
7812  14:05:26.712812 <... futex resumed> ) = 1
7819  14:05:26.712821 futex(0x7f1a7d2ba208, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
7812  14:05:26.712835 futex(0x7f1a7d2ba208, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
7819  14:05:26.712846 <... futex resumed> ) = -1 EAGAIN (Resource temporarily unavailable)
7812  14:05:26.712859 <... futex resumed> ) = 0
7819  14:05:26.712869 futex(0x7f1a7d2ba208, FUTEX_WAKE_PRIVATE, 1) = 0
7819  14:05:26.712918 futex(0x7f1a7d2ba234, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 3, {1458842727, 712901115}, ffffffff <unfinished ...>
7812  14:05:26.713077 pselect6(4, [3], [], [], {0, 95000000}, {NULL, 8}) = 0 (Timeout)
7812  14:05:26.808697 pselect6(4, [3], [], [], {10, 165000000}, {NULL, 8} <unfinished ...>
7819  14:05:27.713099 <... futex resumed> ) = -1 ETIMEDOUT (Connection timed out)
7819  14:05:27.713327 futex(0x7f1a7d2ba208, FUTEX_WAKE_PRIVATE, 1) = 0
7819  14:05:27.713632 munmap(0x7f1a2b62e000, 126976) = 0
7819  14:05:27.713967 futex(0x7f1a7d2ba234, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 5, {1458842728, 713896036}, ffffffff) = -1 ETIMEDOUT (Connection timed out)
7819  14:05:28.714256 futex(0x7f1a7d2ba208, FUTEX_WAKE_PRIVATE, 1) = 0
7819  14:05:28.714563 munmap(0x7f1a2b4cf000, 126976) = 0
7819  14:05:28.714881 futex(0x7f1a7d2ba234, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 7, {1458842729, 714813947}, ffffffff) = -1 ETIMEDOUT (Connection timed out)
7819  14:05:29.715188 futex(0x7f1a7d2ba208, FUTEX_WAKE_PRIVATE, 1) = 0
7819  14:05:29.715506 futex(0x7f1a7d2ba234, FUTEX_WAIT_PRIVATE, 9, NULL <unfinished ...>
7812  14:05:36.984095 <... pselect6 resumed> ) = 0 (Timeout)
7818  14:05:36.984172 <... pselect6 resumed> ) = 0 (Timeout)
7812  14:05:36.984233 pselect6(4, [3], [], [], {18, 990000000}, {NULL, 8} <unfinished ...>
7818  14:05:36.984299 socket(PF_NETLINK, SOCK_RAW, 0) = 4
7818  14:05:36.984597 bind(4, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 0
7818  14:05:36.984907 getsockname(4, {sa_family=AF_NETLINK, pid=7812, groups=00000000}, [12]) = 0
7818  14:05:36.985189 sendto(4, "\24\0\0\0\22\0\1\3p,\364V\0\0\0\0\0\0\0\0", 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20
7818  14:05:36.985528 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"|\4\0\0\20\0\2\0p,\364V\204\36\0\0\0\0\4\3\1\0\0\0I\0\1\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 3452
7818  14:05:36.985741 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\24\0\0\0\3\0\2\0p,\364V\204\36\0\0\0\0\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 20
7818  14:05:36.986030 sendto(4, "\24\0\0\0\26\0\1\3q,\364V\0\0\0\0\0\0\0\0", 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20
7818  14:05:36.986298 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"L\0\0\0\24\0\2\0q,\364V\204\36\0\0\2\10\200\376\1\0\0\0\10\0\1\0\177\0\0\1"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 164
7818  14:05:36.986509 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"H\0\0\0\24\0\2\0q,\364V\204\36\0\0\n\200\200\376\1\0\0\0\24\0\1\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 144
7818  14:05:36.986708 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\24\0\0\0\3\0\2\0q,\364V\204\36\0\0\0\0\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 20
7818  14:05:36.986876 close(4)          = 0
7818  14:05:36.987089 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
7818  14:05:36.987252 ioctl(4, SIOCGIFHWADDR, {ifr_name="eth0", ifr_hwaddr=e0:69:95:25:81:88}) = 0
7818  14:05:36.987370 close(4)          = 0
7818  14:05:36.987495 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
7818  14:05:36.987602 ioctl(4, SIOCGIFHWADDR, {ifr_name="wlan0", ifr_hwaddr=48:5d:60:db:05:21}) = 0
7818  14:05:36.987706 close(4)          = 0
7818  14:05:36.987825 write(5, "\1\0\0\0\0\0\0\0", 8) = 8
7818  14:05:36.987951 socket(PF_NETLINK, SOCK_RAW, 0) = 4
7818  14:05:36.988054 bind(4, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 0
7818  14:05:36.988154 getsockname(4, {sa_family=AF_NETLINK, pid=7812, groups=00000000}, [12]) = 0
7818  14:05:36.988256 sendto(4, "\24\0\0\0\22\0\1\3p,\364V\0\0\0\0\0\0\0\0", 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20
7818  14:05:36.988414 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"|\4\0\0\20\0\2\0p,\364V\204\36\0\0\0\0\4\3\1\0\0\0I\0\1\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 3452
7818  14:05:36.988542 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\24\0\0\0\3\0\2\0p,\364V\204\36\0\0\0\0\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 20
7818  14:05:36.988655 sendto(4, "\24\0\0\0\26\0\1\3q,\364V\0\0\0\0\0\0\0\0", 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20
7818  14:05:36.988771 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"L\0\0\0\24\0\2\0q,\364V\204\36\0\0\2\10\200\376\1\0\0\0\10\0\1\0\177\0\0\1"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 164
7818  14:05:36.988895 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"H\0\0\0\24\0\2\0q,\364V\204\36\0\0\n\200\200\376\1\0\0\0\24\0\1\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 144
7818  14:05:36.989014 recvmsg(4, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\24\0\0\0\3\0\2\0q,\364V\204\36\0\0\0\0\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 20
7818  14:05:36.989136 close(4)          = 0
7818  14:05:36.989330 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
7818  14:05:36.989444 ioctl(4, SIOCGIFHWADDR, {ifr_name="eth0", ifr_hwaddr=e0:69:95:25:81:88}) = 0
7818  14:05:36.989549 close(4)          = 0
7818  14:05:36.989661 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
7818  14:05:36.989766 ioctl(4, SIOCGIFHWADDR, {ifr_name="wlan0", ifr_hwaddr=48:5d:60:db:05:21}) = 0
7818  14:05:36.989867 close(4)          = 0
7818  14:05:36.989990 pselect6(6, [5], [], [], {0, 0}, {NULL, 8}) = 1 (in [5], left {0, 0})
7818  14:05:36.990120 read(5, "\1\0\0\0\0\0\0\0", 8) = 8
7818  14:05:36.990233 write(3, "\1\0\0\0\0\0\0\0", 8) = 8
7812  14:05:36.990317 <... pselect6 resumed> ) = 1 (in [3], left {18, 983999334})
7818  14:05:36.990371 pselect6(6, [5], [], [], {9, 983000000}, {NULL, 8} <unfinished ...>
7812  14:05:36.990414 read(3, "\1\0\0\0\0\0\0\0", 8) = 8
7812  14:05:36.990516 pselect6(4, [3], [], [], {18, 983000000}, {NULL, 8}) = ? ERESTARTNOHAND (To be restarted if no handler)
7812  14:05:45.728071 --- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
7807  14:05:45.729326 <... epoll_wait resumed> 7ffcc5691410, 1024, -1) = -1 EINTR (Interrupted system call)
7822  14:05:45.729438 +++ killed by SIGINT +++
7821  14:05:45.729477 +++ killed by SIGINT +++
7820  14:05:45.729506 +++ killed by SIGINT +++
7819  14:05:45.729540 +++ killed by SIGINT +++
7817  14:05:45.729573 +++ killed by SIGINT +++
7807  14:05:45.731504 --- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
7807  14:05:45.731609 tgkill(7807, 7807, SIGINT) = 0
7807  14:05:45.731649 rt_sigreturn()    = -1 EINTR (Interrupted system call)
7807  14:05:45.731689 --- SIGINT {si_signo=SIGINT, si_code=SI_TKILL, si_pid=7807, si_uid=1000} ---
7816  14:05:45.731862 +++ killed by SIGINT +++
7815  14:05:45.731894 +++ killed by SIGINT +++
7814  14:05:45.731905 +++ killed by SIGINT +++
7813  14:05:45.731915 +++ killed by SIGINT +++
7808  14:05:45.731925 +++ killed by SIGINT +++
7818  14:05:45.733838 +++ killed by SIGINT +++
7812  14:05:45.733899 +++ killed by SIGINT +++
7811  14:05:45.733932 +++ killed by SIGINT +++
7810  14:05:45.733943 +++ killed by SIGINT +++
7809  14:05:45.734243 +++ killed by SIGINT +++
7807  14:05:45.734283 +++ killed by SIGINT +++

@localnerve
Copy link
Author

New information.
In an effort to make progress, I've identified this problem has nothing to do with require but with the throwing/handling of the resulting error (from bad input).

I achieved the same non-responsive system after running code that tested for bad input (skipping the previously suspected require), and instead just threw a plain error when the bad input was detected:

throw new Error('invalid module supplied');

Just throwing this error caused the same non-responsive system.

So moving focus to my error handler:

function _exit(code, msg) {
  if (code !== 0) {
    console.error(msg);
  } else {
    console.log(msg);
  }
  phantom.exit(code);
}

/**
 * Global error handler
 */
phantom.onError = function(msg, trace) {
  var msgStack = ["PhantomJS error: " + msg];
  if (trace && trace.length) {
    msgStack.push("Trace:");
    trace.forEach(function(t) {
      msgStack.push(" -> " + (t.file || t.sourceURL) + ": " + t.line + (t.function ? " (in function " + t.function +")" : ""));
    });
  }
  _exit(-1, msgStack.join("\n"));
};

This is the probable cause, although I still don't understand why this is wrong as of phantomjs 2.x.

Any advice/direction appreciated.
Thanks for all your help so far.

@localnerve
Copy link
Author

After many more trials/reboots, I found that simply not calling the _exit function (above) from the phantomjs.onError handler fixed the problem of the system becoming non-responsive.

/**
 * Global error handler
 */
phantom.onError = function(msg, trace) {
  var msgStack = ["PhantomJS error: " + msg];
  if (trace && trace.length) {
    msgStack.push("Trace:");
    trace.forEach(function(t) {
      msgStack.push(" -> " + (t.file || t.sourceURL) + ": " + t.line + (t.function ? " (in function " + t.function +")" : ""));
    });
  }
  console.log(msgStack.join("\n"));
  phantom.exit(-1);
};

(I switched to console.log for output preference only).

Again, this was a problem for the linux prebuilt binary only.

Hopefully, this information is helpful to the project. Thanks again for all the assistance here.

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

No branches or pull requests

4 participants