Skip to content

Electron crashes with native packages (glib version issue) #46323

Open

Description

@ollm

Preflight Checklist

Electron Version

34.3.3

What operating system(s) are you using?

Ubuntu

Operating System Version

Ubuntu 24.04.2, Arch Linux, etc

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

Electron should run correctly on modern Linux distributions when used with native packages, like sharp.

Actual Behavior

Currently, depending on the system's glib version, packages like sharp crashes when are used with electron (assertion failed)

That's why I think we should consider reopening #25495, since it was automatically closed by github-actions and it's still to be a problem that affects different electron apps.

Related issues: lovell/sharp#4129, lovell/sharp#4348 and lovell/sharp#4351

Testcase Gist URL

No response

Additional Information

No response

Activity

  1. added theissue type on Mar 27, 2025
  2. added
    blocked/need-repro
    on Mar 27, 2025
  3. electron-issue-triage commented on Mar 27, 2025

    @electron-issue-triage

    Hello @ollm. Thanks for reporting this and helping to make Electron better!

    Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, Electron Fiddle is a great tool for making small test cases and makes it easy to publish your test case to a gist that Electron maintainers can use.

    Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.

    Now adding the blocked/need-repro Needs a test case to reproduce the bug label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.

  4. ollm commented on Mar 27, 2025

    @ollm
    Author

    I have created two testcase repositories.


    Electron sharp 33

    https://github.com/ollm/electron-sharp-33

    This one, for example, works on Ubuntu 24.04.2 but not on the latest version of Arch Linux.

    Electron sharp 34

    https://github.com/ollm/electron-sharp-34

    This one, in contrast, works on Arch Linux but not on Ubuntu 24.04.2.


    If run directly from the terminal, without electron, both work as expected.

    node ./www/js/app.js
    Loaded sharp correctly
    Random 100x100 image: Blob { size: 30230, type: 'image/png' }
    Buffer: <Buffer 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 64 00 00 00 64 08 02 00 00 00 ff 80 02 03 00 00 00 09 70 48 59 73 00 00 03 e8 00 00 03 e8 01 ... 30180 more bytes>
  5. removed
    blocked/need-repro
    on Mar 27, 2025
  6. nikwen commented on Mar 27, 2025

    @nikwen
    Member

    Thanks!

    1. Could you please adjust the title of the issue to describe the crash/bug better? I think we'll just keep this new issue instead of reopening the old one.
    2. Does the same behavior occur if you run sharp from the main thread instead of the renderer? (I'd think so, but let's make sure.)

    For maintainers reading this: Here's a good analysis of what's going on: lovell/sharp#4351 (comment). It looks like the issue was caused by a glibc update in the sharp library that clashes with Electron's glibc version.

  7. added
    blocked/need-info ❌
    on Mar 27, 2025
  8. changed the title [-]Consider reopening #25495 issue (Static builds for Linux prebuilt binaries)[/-] [+]Electron crashes with native packages (glib version issue)[/+] on Mar 27, 2025
  9. ollm commented on Mar 27, 2025

    @ollm
    Author

    Thanks for your reply!

    Could you please adjust the title of the issue to describe the crash/bug better? I think we'll just keep this new issue instead of reopening the old one.

    I have updated the title.

    Does the same behavior occur if you run sharp from the main thread instead of the renderer? (I'd think so, but let's make sure.)

    I just tried them from the main thread and the same thing happens.

    Tested main.js
    const { app, BrowserWindow } = require('electron')
    const path = require('path')
    
    function createWindow () {
    
    	const sharp = require('sharp');
    
    	const width = 100;
    	const height = 100;
    	const channels = 3;
    	const image = [];
    
    	for(let i = 0; i < width * height * channels; i++)
    	{
    		image.push(Math.floor(Math.random() * 256));
    	}
    
    	const isFromCLI = (process.argv[1].indexOf('app.js') !== -1);
    
    	sharp(Buffer.from(image), {
    		raw: {
    			width,
    			height,
    			channels,
    		}
    	}).png({force: true}).toBuffer(function(error, buffer) {
    
    		const blob = new Blob([buffer], {type: 'image/png'});
    		console.log('Loaded sharp correctly');
    		console.log('Random 100x100 image:', blob);
    		console.log('Buffer:', buffer);
    
    	});
    
    	const win = new BrowserWindow({
    		width: 1280,
    		height: 720,
    		webPreferences: {
    			plugins: true, 
    			contextIsolation: false,
    			nodeIntegration: true,
    			nodeIntegrationInWorker: true,
    			enableRemoteModule: true,
    			backgroundThrottling: false,
    			nativeWindowOpen: false,
    		},
    	})
    
    	win.loadFile('../index.html');
    
    	// Open the DevTools.
    	// win.webContents.openDevTools()
    }
    
    app.whenReady().then(() => {
    
    	createWindow()
    
    	app.on('activate', () => {
    		if (BrowserWindow.getAllWindows().length === 0) {
    			createWindow()
    		}
    	})
    })
    
    app.on('window-all-closed', () => {
    	if (process.platform !== 'darwin') {
    		app.quit()
    	}
    })
  10. removed
    blocked/need-info ❌
    on Mar 27, 2025
  11. deleted a comment from on Mar 29, 2025
  12. 40 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions