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

Segmentation fault .toBuffer() #2191

Closed
qwertyforce opened this issue Apr 30, 2020 · 2 comments
Closed

Segmentation fault .toBuffer() #2191

qwertyforce opened this issue Apr 30, 2020 · 2 comments

Comments

@qwertyforce
Copy link

Are you using the latest version? Is the version currently in use as reported by npm ls sharp the same as the latest version as reported by npm view sharp dist-tags.latest? Yes

What are the steps to reproduce?
run this

const axios = require('axios');
const sharp = require('sharp');
 

async function blur (image_url) {
  let pic= await axios.get(image_url,{responseType: 'arraybuffer' })
  let f=await sharp(pic.data).blur(6)
  return f.toBuffer();
}
 
blur("https://i.imgur.com/bFDWhkK.jpg")
 

What is the expected behaviour? Not crashing.

What is the output of running npx envinfo --binaries --system?
System:
OS: Linux 4.19 Debian GNU/Linux 10 (buster) 10 (buster)
CPU: (3) x64 QEMU Virtual CPU version 2.5+
Memory: 301.80 MB / 986.84 MB
Container: Yes
Shell: 5.0.3 - /bin/bash
Binaries:
Node: 13.3.0 - /usr/bin/node
npm: 6.14.4 - /usr/bin/npm

I tried:
npm install github:lovell/sharp#master
npm install github:lovell/sharp#master --build-from-source
npm install sharp
npm install sharp --build-from-source
sharp.simd(false)
sharp.cache(false)
sharp.concurrency(1);

segfault-handler log:

PID 11323 received SIGSEGV for address: 0x28
/home/test_pr/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x3216)[0x7fa9c80ff216]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12730)[0x7fa9c8ae5730]
node(_ZN2v811HandleScopeC2EPNS_7IsolateE+0x60)[0xb599f0]
node[0x9c3fc3]
node(_ZN4node11Environment27RunAndClearNativeImmediatesEb+0x1ba)[0x9914da]
node(_ZN4node11Environment14CleanupHandlesEv+0x3c)[0x99d76c]
node(_ZN4node11Environment10RunCleanupEv+0x32e)[0x99dbee]
node(_ZN4node16NodeMainInstance3RunEv+0xc0)[0xa2e820]
node(_ZN4node5StartEiPPc+0x131)[0x9c2f21]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb)[0x7fa9c893609b]
node[0x95fe55]

Also cpu doesn't support avx instructions
/proc/cpuinfo (3 cores)

processor       : 2
vendor_id       : GenuineIntel
cpu family      : 6
model           : 13
model name      : QEMU Virtual CPU version 2.5+
stepping        : 3
microcode       : 0x1
cpu MHz         : 3311.984
cache size      : 16384 KB
physical id     : 2
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 2
initial apicid  : 2
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm rep_good nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm pti
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips        : 6623.96
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

.toFile() is working without Segmentation fault

@lovell
Copy link
Owner

lovell commented May 1, 2020

Hello, this stacktrace appears to be from within Node.js itself and does not include any sharp or libvips functions.

Please can you try to get a backtrace using gdb rather than the segfault-handler module as you might have run into ddopson/node-segfault-handler#63 given the use of Node.js 13.

Are you able to recreate this without the use of QEMU? If not, please can you provide the flags you are starting qemu-system with to allow someone else to reproduce.

@qwertyforce
Copy link
Author

gdb showed something about V8 Buffers. I've updated node.js and now everything is working! Thanks!

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