NodeBB crashes when uploading images


  • Log output:

    2021-05-06T01:18:54.643Z [4567/23252] - info: NodeBB Ready
    2021-05-06T01:18:54.646Z [4567/23252] - info: Enabling 'trust proxy'
    2021-05-06T01:18:54.651Z [4567/23252] - info: NodeBB is now listening on: 0.0.0.0:4567
    [cluster] Child Process (23252) has exited (code: null, signal: SIGILL)
    [cluster] Spinning up another process...
    

    As you can see, strangely, there isn't even an error.

    I'm using the latest version of NodeBB


  • @teresa-hale-dhq Update: I attached a debugger to the Node process; here's the output from that.

    (gdb) attach 472
    Attaching to process 472
    [New LWP 473]
    [New LWP 474]
    [New LWP 475]
    [New LWP 476]
    [New LWP 477]
    [New LWP 478]
    [New LWP 483]
    [New LWP 484]
    [New LWP 485]
    [New LWP 486]
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
    0x00007f408e687a47 in epoll_wait (epfd=epfd@entry=14, events=events@entry=0x7fff52341980, maxevents=maxevents@entry=1024,
        timeout=timeout@entry=500) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
    30      ../sysdeps/unix/sysv/linux/epoll_wait.c: No such file or directory.
    (gdb) r
    The program being debugged has been started already.
    Start it from the beginning? (y or n) n
    Program not restarted.
    (gdb) c
    Continuing.
    
    Thread 1 "node" received signal SIGILL, Illegal instruction.
    0x00007f3de6dc1f1f in ?? () from /home/forum/node_modules/sharp/build/Release/../../vendor/8.10.6/lib/libvips-cpp.so.42
    (gdb) quit
    

    Idk if this'll be of use, but putting it here in case it is.

  • Global Moderator Plugin & Theme Dev

    What platform are you on? What version of Node? Did you recently upgrade? Maybe try npm rebuild


  • @pitaj I'm on Ubuntu 18.04, using Node.js version 14.16.1.
    I tried npm rebuild and restarting NodeBB, but it still crashes whenever I try to upload an image.

  • Global Moderator Plugin & Theme Dev

    Oh actually I think you need to do npm rebuild sharp. Try that and share the output from it.


  • @pitaj

    root@rockfic:/home/forum# npm rebuild sharp
    
    > sharp@0.28.1 install /home/forum/node_modules/sharp
    > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
    
    sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.6/libvips-8.10.6-linux-x64.tar.br
    sharp@0.28.1 /home/forum/node_modules/sharp
    
    

    Even still, whenever I try uploading an image, I get this:

    [cluster] Child Process (24423) has exited (code: null, signal: SIGILL)
    [cluster] Spinning up another process...
    
  • Global Moderator Plugin & Theme Dev

    Okay so just to confirm this is caused by an error in sharp, try creating a file called test-sharp.js in your nodebb directory with the following contents:

    'use strict';
    
    const fs = require('fs/promises');
    const sharp = require('sharp');
    
    async function run() {
    	const input = await fs.readFile('public/logo.png');
    	await sharp(input)
    		.resize({ width: 100 })
    		.toFile('build/public/logo.png');
    }
    
    run().then(() => {}, err => setTimeout(() => { throw err; }, 0));
    

    Then run it like node test-sharp.js. It should create the file build/public/logo.png. Check the exit code with echo $?.

Suggested Topics

| |