-
Notifications
You must be signed in to change notification settings - Fork 15k
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
[Bug]: window.print()
without printers causes the main process to crash
#31151
Comments
Same problem with v14 on Linux. It crashes the application: laurent22/joplin#5651 |
This persists in v15.3.0
|
Can this be triaged, please? Having the main process crash in response to an absolutely fine call in the renderer seems some pretty disruptive behaviour. |
I have the same issue on electron v16. I already tested it with Any Ideas/ solutions? |
I encountered the same issue on electron v14.2.1. However, this does not seem to be an issue whether there is a (default) printer configured or not. I have a configured printer, that shows up if I print anything using the system print window. Only electron crashes:
This is only a problem on my Ubuntu 21.10 machine, but not on my macOS 12.0.1 macbook. |
Please attach a crash dump. You can collect them by adding the following snippet to your main process code, before app.whenReady: const { app, crashReporter } = require('electron')
console.log(app.getPath('crashDumps'))
crashReporter.start({ submitURL: '', uploadToServer: false }) Then reproduce the crash, zip up the crash dumps directory and attach it here. |
@nornagon I just tried that but the crash directory wasn't even created. This is the gist I just tried: It still crashes with v16.0.7 and 17.0.0-beta.3. |
@nornagon Here is a fresh crash dump. :) |
i have the same problem on v17.0.1
@nornagon if i try to generate the crash dump i get : |
It is happening to our users quite a lot but not across all distros (e.g. happening on Ubuntu 22.04 and older, does not occur on Fedora 36, does not occurs on Debian 11). |
I just tried this fiddle with v17.0.0 and the print window does open, but the whole program crashes as soon as I cancel the dialog (without the weird stacktrace or FD violation errors, just a SIGSEGV). |
For maintainers I would ilke to point out that this seems to be related to network printers |
Good catch, we're indeed only using network printers, it never occurred to me that it was tested with a local printer. |
I'm using linux
//package.json "devDependencies": {
"electron": "^22.0.0",
"electron-builder": "^23.6.0",
},
"build": {
"appId": "appId",
"productName": "management",
"publish": [
{
"provider": "generic",
"url": "http://127.0.0.1:8080/"
}
],
"linux": {
"target": [
"AppImage",
"deb"
],
"icon": "icon/logo.png"
},
} update:
will be attach |
Although it says v13.4.0 works in the issue, it also fails with pulsar's electron version (v12.2.3) Edit: As mentioned in the issue mentioning this one, the electron build instructions for linux fundamentally require various |
Issue exist in ^21.0.0 when Linux machine have network printer configured. |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
It still does not work with electron 24.4.1. With electron 25.0.1 nothing happens when calling |
This issue still exists. I was trying to print on my Ubuntu 22.04.2 LTS and have no printers attached to my pc. I get the error The app should atleast open a print window irrespective of whether there's a printer or not. |
It still does not work with electron 14.x,15.x,16.x,17.x,I was trying to print on my Ubuntu 22.04.6 LTS and only using network printers.I get the error |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
bump |
This issue persists with Electron version
|
Hey, The I've tried to get in contact with anyone who could give some guidance on how we could get it fixed over the last few days (or at least what would be the best way to get it sorted), but didn't get a single response. If nobody from the electron team answers in the next 24 hours, I'll check tomorrow how I can add an option on linux to turn off that FD ownership safety (since adding something to reset FD states after fork() seems like a lot of pain). Have a nice day and I hope it helps! |
as far as i understand your latest fix PR didn't make it. @Rigner for now i send the path to the backend and use "xdg-open filepath" as a workaround in my app but there needs to be a better way. |
Indeed, I need to allocate time to find a proper solution to that issue... Well for your use case, there would be only one: adding a way to turn off the chromium safeties, like I did in the PR, just need to move the code around Would also need to add a way to reset that safety, it's just annoying to do because you would need to access chromium through electron, from a native lib, and my knowledge on that part is quite limited (+ only a few people know about that topic, I wasn't able to find anyone who could help me when I made that feature) |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
bump -- AFAIK this still occurs |
Preflight Checklist
Electron Version
14.0.1
What operating system are you using?
Ubuntu
Operating System Version
5.11.0-37-generic #41-Ubuntu SMP Mon Sep 20 16:39:20 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
What arch are you using?
x64
Last Known Working Electron version
13.4.0
Expected Behavior
Calling
window.print()
should open the print window, even if there are no printers installed in the system.Actual Behavior
Calling
window.print()
from the renderer process crashes the main process.Testcase Gist URL
https://gist.github.com/85a5466567215173419a17982e79becb
Additional Information
When the process crashes, the terminal prints:
When calling
BrowserWindow.print()
, the console prints:[22590:0927/121740.971531:ERROR:print_backend_cups.cc(218)] CUPS: Error getting default printer: No destinations added.
and the print callback is called with
[ false, 'no valid printers available' ]
for args. The main process does not crash, but the print window never opens (I have filed a similar issue back at v10.x: #25498)On v13.4.0, a similar error message is printed, but the process does not crashes (or does, but recovers immediately somehow):
Also, the print window is correctly displayed, containing only the 'Print to File' option.
The text was updated successfully, but these errors were encountered: