How to Solve “parcel segmentation fault” Error in Linux

parcel is a very good all-in-one simple tool, which can facilitate web construction, because no problems were found when using mac to build, but when running on linux, it was
found that there was a problem, a segmentation fault occurred, and I tried a few times. There are various solutions (upgrade npm, node, yarn version) but none of them are solved, and try to use
strace information as follows

rt_sigprocmask( SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask( SIG_SETMASK, ~[ RTMIN RT_1], [], 8) = 0
read( 4, "*", 1)                          = 1
rt_sigaction( SIGIO, { sa_handler = SIG_DFL, sa_mask =[], sa_flags = SA_RESTORER, sa_restorer = 0x7eff95e58630}, NULL, 8) = 0
write( 5, "*", 1)                         = 1
rt_sigprocmask( SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask( SIG_SETMASK, ~[ RTMIN RT_1], [], 8) = 0
read( 4, "*", 1)                          = 1
rt_sigaction( SIGPWR, { sa_handler = SIG_DFL, sa_mask =[], sa_flags = SA_RESTORER, sa_restorer = 0x7eff95e58630}, NULL, 8) = 0
write( 5, "*", 1)                         = 1
rt_sigprocmask( SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask( SIG_SETMASK, ~[ RTMIN RT_1], [], 8) = 0
read( 4, "*", 1)                          = 1
rt_sigaction( SIGSTKFLT, { sa_handler = SIG_DFL, sa_mask =[], sa_flags = SA_RESTORER, sa_restorer = 0x7eff95e58630}, NULL, 8) = 0
write( 5, "*", 1)                         = 1
rt_sigprocmask( SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask( SIG_SETMASK, ~[ RTMIN RT_1], [], 8) = 0
read( 4, "*", 1)                          = 1
rt_sigaction( SIGSYS, { sa_handler = SIG_DFL, sa_mask =[], sa_flags = SA_RESTORER, sa_restorer = 0x7eff95e58630}, NULL, 8) = 0
write( 5, "*", 1)                         = 1
rt_sigprocmask( SIG_SETMASK, [], NULL, 8) = 0
write( 17, "", 0)                         = 0
futex( 0x306c80c, FUTEX_CMP_REQUEUE_PRIVATE, 1, 2147483647, 0x306c7e0, 100) = 4
write( 12, "\1\0\0\0\0\0\0\0", 8)         = 8
futex( 0x7eff95a7a9d0, FUTEX_WAIT, 30173, NULL) = - 1 EAGAIN ( Resource temporarily unavailable)
munmap( 0x7eff9527a000, 8392704)          = 0
epoll_ctl( 3, EPOLL_CTL_ADD, 6, { EPOLLIN, { u32 = 6, u64 = 6 } } ) = 0
epoll_ctl( 3, EPOLL_CTL_ADD, 8, { EPOLLIN, { u32 = 8, u64 = 8 } } ) = 0
epoll_wait( 3, [], 1024, 0)               = 0
close( 6)                                 = 0
close( 7)                                 = 0
close( 8)                                 = 0
close( 3)                                 = 0
fstat( 0, { st_mode = S_IFCHR | 0620, st_rdev = makedev( 136, 0), ...}) = 0
fcntl( 0, F_GETFL)                        = 0x8002 ( flags O_RDWR | O_LARGEFILE)
rt_sigprocmask( SIG_BLOCK, [ TTOU], NULL, 8) = 0
ioctl( 0, SNDCTL_TMR_START or TCSETS, { B38400 opost isig icanon echo ...}) = 0
ioctl( 0, TCGETS, { B38400 opost isig icanon echo ... }) = 0
rt_sigprocmask( SIG_UNBLOCK, [ TTOU], NULL, 8) = 0
fstat( 1, { st_mode = S_IFCHR | 0620, st_rdev = makedev( 136, 0), ...}) = 0
fcntl( 1, F_GETFL)                        = 0x8002 ( flags O_RDWR | O_LARGEFILE)
rt_sigprocmask( SIG_BLOCK, [ TTOU], NULL, 8) = 0
ioctl( 1, SNDCTL_TMR_START or TCSETS, { B38400 opost isig icanon echo ...}) = 0
ioctl( 1, TCGETS, { B38400 opost isig icanon echo ... }) = 0
rt_sigprocmask( SIG_UNBLOCK, [ TTOU], NULL, 8) = 0
fstat( 2, { st_mode = S_IFCHR | 0620, st_rdev = makedev( 136, 0), ...}) = 0
fcntl( 2, F_GETFL)                        = 0x8002 ( flags O_RDWR | O_LARGEFILE)
rt_sigprocmask( SIG_BLOCK, [ TTOU], NULL, 8) = 0
ioctl( 2, SNDCTL_TMR_START or TCSETS, { B38400 opost isig icanon echo ...}) = 0
ioctl( 2, TCGETS, { B38400 opost isig icanon echo ... }) = 0
rt_sigprocmask( SIG_UNBLOCK, [ TTOU], NULL, 8) = 0
close( 4)                                 = 0
close( 5)                                 = 0
# There will be exception information here
futex( 0x2c97aa4, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x2c97aa0, FUTEX_OP_SET << 28 | 0 << 12 | FUTEX_OP_CMP_GT << 24 | 0x1) = 1
futex( 0x2c97a60, FUTEX_WAKE_PRIVATE, 1) = 1
futex( 0x7eff8effd9d0, FUTEX_WAIT, 30179, NULL) = 0
munmap( 0x7eff94a79000, 8392704)          = 0
munmap( 0x7eff94278000, 8392704)          = 0
munmap( 0x7eff8f7ff000, 8392704)          = 0
munmap( 0x7eff8effe000, 8392704)          = 0
exit_group( 0)                            = ?
+++ exited with 0 +++

The discovery is not very clear, and the trace information of perf is used as follows

1340.638 ( 43.568 ms): node / 30376   ... [ continued]: futex()) = 0
  1384.214 ( 0.008 ms): node / 30376 futex( uaddr: 0x2c97aa4, op: WAKE_OP | PRIV, val: 1, utime: 0x1, uaddr2: 0x2c97aa0, val3: 0x4000001d) = 1
  1384.226 ( 0.003 ms): node / 30376 futex( uaddr: 0x2c97a60, op: WAKE | PRIV, val: 1 ) = 0
  1384.236 ( 0.009 ms): node / 30376 madvise( start: 0x7f096e8db000, len_in: 8368128, behavior: MADV_DONTNEED) = 0
  1384.249( ): node / 30376 exit( )
  1340.722 ( 43.609 ms): node / 30378   ... [ continued]: futex()) = 0
  1384.337 ( 0.006 ms): node / 30378 futex( uaddr: 0x2c97aa4, op: WAKE_OP | PRIV, val: 1, utime: 0x1, uaddr2: 0x2c97aa0, val3: 0x4000001d) = 1
  1384.346 ( 0.003 ms): node / 30378 futex( uaddr: 0x2c97a60, op: WAKE | PRIV, val: 1 ) = 0
  1384.354 ( 0.007 ms): node / 30378 madvise( start: 0x7f096d8d9000, len_in: 8368128, behavior: MADV_DONTNEED) = 0
  1384.364( ): node / 30378 exit( )
  1341.178 ( 43.235 ms): node / 30377   ... [ continued]: futex()) = 0
  1384.417 ( 0.012 ms): node / 30377 futex( uaddr: 0x2c97aa4, op: WAKE_OP | PRIV, val: 1, utime: 0x1, uaddr2: 0x2c97aa0, val3: 0x4000001d) = 1
  1384.432 ( 0.003 ms): node / 30377 futex( uaddr: 0x2c97a60, op: WAKE | PRIV, val: 1 ) = 0
  1384.439 ( 0.005 ms): node / 30377 madvise( start: 0x7f096e0da000, len_in: 8368128, behavior: MADV_DONTNEED) = 0
  1384.447( ): node / 30377 exit( )
   307.570 ( 1077.301 ms): node / 30373   ... [ continued]: futex()) = - 1 ( unknown) INTERNAL ERROR: strerror_r( 512, [ buf], 128) = 22
         ? ( ​​): node / 30355   ... [ continued]: epoll_wait()) = 1
  1402.290 ( 0.004 ms): node / 30355 read( fd: 12, buf: 0x7fc200eaa8d0, count: 1024 ) = 8
  1402.305 ( 0.003 ms ): node / 30355 close( fd: 10 ) = 0
  1402.314 ( 0.002 ms): node / 30355 close( fd: 11 ) = 0
  1402.324 ( 0.002 ms): node / 30355 close( fd: 12) = 0
  1402.331 ( 0.002 ms ): node / 30355 close( fd: 9 ) = 0
  1402.341 ( 0.007 ms): node / 30355 madvise( start: 0x7fc2006ae000, len_in: 8368128, behavior: MADV_DONTNEED) = 0
  1402.351( ): node / 30355 exit( )
   281.999 ( 1121.739 ms): node / 30362   ... [ continued]: futex()) = 0
  1403.750 ( 0.008 ms): node / 30362 futex( uaddr: 0x2c97aa4, op: WAKE_OP | PRIV, val: 1, utime: 0x1, uaddr2: 0x2c97aa0, val3: 0x4000001d) = 1
  1403.760 ( 0.002 ms): node / 30362 futex( uaddr: 0x2c97a60, op: WAKE | PRIV, val: 1 ) = 0
  1403.766 ( 0.004 ms): node / 30362 madvise( start: 0x7fc1f8ffa000, len_in: 8368128, behavior: MADV_DONTNEED) = 0
  1403.772( ): node / 30362 exit( )
   282.093 ( 1121.731 ms): node / 30364   ... [ continued]: futex()) = 0
  1403.831 ( 0.009 ms): node / 30364 futex( uaddr: 0x2c97aa4, op: WAKE_OP | PRIV, val: 1, utime: 0x1, uaddr2: 0x2c97aa0, val3: 0x4000001d) = 1
  1403.842 ( 0.002 ms): node / 30364 futex( uaddr: 0x2c97a60, op: WAKE | PRIV, val: 1 ) = 0
  1403.846 ( 0.004 ms): node / 30364 madvise( start: 0x7fc1eb7ff000, len_in: 8368128, behavior: MADV_DONTNEED) = 0
  1403.852( ): node / 30364 exit( )
    13.769 ( 1390.637 ms): node / 30360   ... [ continued]: futex()) = - 1 ( unknown) INTERNAL ERROR: strerror_r( 512, [ buf], 128) = 22

I saw some things but I am still not sure how to solve it. Then I searched the github issue and found a lot of similar problems. From the description, the source-map plugin is related to the integration of rust

Solution

Very simple, the temporary solution is to add environment variables PARCEL_WORKER_BACKEND=processThe problem is temporarily solved, rust is good, but there is also a problem with rust and external integration (
many extensions of parcel use rust extensions)

References

https://github.com/parcel-bundler/parcel/issues/7598
https://github.com/parcel-bundler/source-map/pull/91

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *