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

Renderer crashes with iframes in webContents #51

Closed
ibash opened this issue Mar 20, 2018 · 23 comments
Closed

Renderer crashes with iframes in webContents #51

ibash opened this issue Mar 20, 2018 · 23 comments
Assignees

Comments

@ibash
Copy link

ibash commented Mar 20, 2018

Steps:

  1. ???
  2. require('@sentry/electron')

Expected:
Works

Actual:
Causes one of our renderer processes to crash

We instantiate a webContents with webContents.create. If we put a preload in there that requires this package, it causes that process to crash when the app loads.

Let me know if you need any more information.

It would be great if sentry could simply give me a crash reporter url to send crashes to...

Also... getsentry/sentry-wizard#5

@ibash
Copy link
Author

ibash commented Mar 20, 2018

funny enough it seems like sentry was actually able to catch the crashes it was causing... https://sentry.io/superhuman/electron/issues/498531913/

@jan-auer
Copy link
Member

Hi @ibash, thank you for reporting this bug. Could you please clarify what you mean by "put a preload in there"?

Judging by the fact that this is a native crash, the SDK is either accessing some environment too early during WebContents creation when it's not yet allowed, or we've hit a bug in Electron. Are you using async_hooks or domain by any chance? It's also interesting, that the SDK was able to set up the CrashReporter, this already rules out a lot of possibilities.

Ideally, we could create a minimal reproducing example. Could you maybe share relevant code parts here or via email to [email protected]` so I can try to reproduce this locally?

In the meanwhile, you can obtain the CrashReporter URL by using the CSP Endpoint URL in Project Settings > Client Keys (DSN) and replacing "csp-report" with "minidump", e.g.: https://sentry.io/api/<id>/minidump?sentry_key=<key>. We will show this URL in settings once we roll out full support for Minidumps.

@ibash
Copy link
Author

ibash commented Mar 20, 2018

I meant requiring the sentry package within a preload file (passed as an option to webContents.create).
I spent some time trying to create a minimal reproduction repo, but couldn't quite get it, so this might be something that's mostly unique to us.

In particular, this seems to be triggered by us creating an iframe in the webContents and then loading a script inside of that iframe with some code we run in the background. It's likely that there's something inside of the background code that's triggering it, but I didn't go farther than that. AFAIK we're not using async_hooks, and I'm fairly sure we're not using domains either.

Let me check what I can give you to reproduce it locally...

@ibash
Copy link
Author

ibash commented Mar 20, 2018

@jan-auer I can generate a build of our electron app that includes sentry (and so would reproduce the crash). If you wanted to modify the code you'd probably need to unpack / repack the asar file.

@jan-auer
Copy link
Member

We have identified a couple of issues that cause troubles with disabled Node integration and sandbox mode. Documentation will be updated soon with current limitations and we are planning to fix those issues in the upcoming releases.

@jan-auer
Copy link
Member

The v0.5.5 release fixes a couple of issues related to node integration and sandboxing and includes more robust internal error handling. It would be great if you could give it another try.

@jeroenvisser101
Copy link

jeroenvisser101 commented Jun 21, 2018

@jan-auer we have the same error, and are using v0.5.5. It seems like that release didn't fix it.

EDIT: We also tried a few options (such as disabling native and javascript reporting), but that didn't change anything. We did try to only require it in the main process, which stopped the crashing.

We too have iframes in our code (embedded from intercom.io). We'll debug some more to see if that's causing it.

@jeroenvisser101
Copy link

Can confirm that removing intercom, and with it all iframes, resolves the crashes too.

@jan-auer
Copy link
Member

@jeroenvisser101 Thanks for reporting this. We have not tried out iframes yet, so there might be a bug lurking in the dark :) I will open a separate issue to track this.

@jeroenvisser101
Copy link

@jan-auer I don't think it's a separate issue, since @ibash mentions this:

In particular, this seems to be triggered by us creating an iframe in the webContents and then loading a script inside of that iframe with some code we run in the background.

@jan-auer
Copy link
Member

You're right. Let's rename this issue for now.

Adding @kamilogorek @HazAT here, since they are updating the SDK currently.

@jan-auer jan-auer changed the title Requiring this package causes our app to crash Renderer crashes with iframes in webContents Jun 25, 2018
@Apex2apex
Copy link

We are experiencing the same thing with our app. We call Sentry.init in our main browser process and all the renderer processes via a preload script. Any iFrame that got created within the renderer would crash the renderer process.

@jeroenvisser101
Copy link

@jan-auer is this still on your radar? We'd very much like to have this shipped with our initial release to aid debugging issues that might arise.

@jan-auer
Copy link
Member

jan-auer commented Jul 5, 2018

@jeroenvisser101 Yes it is, we're currently updating the Electron SDK with new internals and will look at this next.

@jan-auer jan-auer assigned jan-auer and HazAT and unassigned jan-auer Jul 5, 2018
@HazAT
Copy link
Member

HazAT commented Jul 6, 2018

Hey, so I was playing around with this, currently working on #89 but I am not able to reproduce it.
Can you guys provide a minimal reproducible case, ideally in our example we have in the repo?!

@jeroenvisser101
Copy link

Will try to get a reproducible example today

@jeroenvisser101
Copy link

Just adding an iframe doesn't trigger anything in the application. I'll try to set up a project that similar to ours and add sentry-electron to it, but that means I'll defer from the example. Hope that's okay.

@jeroenvisser101
Copy link

@HazAT I've invited you for a private replication repo. We've ran out of seats, if needed, I'll mirror the repo on my personal account so I can add more people.

@jeroenvisser101
Copy link

jeroenvisser101 commented Jul 9, 2018

Realized that we only have a public Intercom token in there, so made it public:

https://github.com/mymobia/sentry-replication-repo

See https://github.com/mymobia/sentry-replication-repo/blob/master/src/renderer/index.js#L4-L5, you can turn on the Intercom test which crashes the renderer.

@HazAT
Copy link
Member

HazAT commented Jul 13, 2018

@jeroenvisser101 I already look at your repro case, thanks for providing it.
I did not have time yet to fully dig into it to see why it's crashing but will certainly do.

@jeroenvisser101
Copy link

I suspect this might be related: electron/electron#12467, which means it's an upstream issue. It should be fixed in electron@3, which I'll be testing today.

@jeroenvisser101
Copy link

I can confirm using electron@3, the renderer doesn't crash and Sentry works.

@HazAT
Copy link
Member

HazAT commented Jul 26, 2018

OK, @jeroenvisser101 thanks for all the investigation you did but I will close this ticket now since it seems not to be only Sentry related.

@HazAT HazAT closed this as completed Jul 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants