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

Crash with offscreen webview on Linux/Windows #8599

Closed
ns opened this issue Feb 6, 2017 · 12 comments · Fixed by #8839
Closed

Crash with offscreen webview on Linux/Windows #8599

ns opened this issue Feb 6, 2017 · 12 comments · Fixed by #8839

Comments

@ns
Copy link

ns commented Feb 6, 2017

Electron version: 1.14.15

NodeJS version: v6.9.5

Operating system: Linux ip-172-31-47-144 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

I have an app that creates a webview, loads a URL, and writes the current image to a file when ready. Setting offscreen: true so I can receive paint events causes Electron to segfault with the following stack trace:

Received signal 11 SEGV_MAPERR 000000000018
#0 0x000001e580f7 <unknown>
#1 0x7f1fb053d390 <unknown>
#2 0x00000329c109 <unknown>
#3 0x000002701928 <unknown>
#4 0x000002706512 <unknown>
#5 0x000002706407 <unknown>
#6 0x000002700ced <unknown>
#7 0x000002700c21 <unknown>
#8 0x000002a068e7 <unknown>
#9 0x0000027c4360 <unknown>
#10 0x000002928434 <unknown>
#11 0x00000330c195 <unknown>
#12 0x000001e59226 <unknown>
#13 0x000001e74755 <unknown>
#14 0x000001e74a48 <unknown>
#15 0x000001e74e9b <unknown>
#16 0x000001e4dffa <unknown>
#17 0x7f1fac2d1197 g_main_context_dispatch
#18 0x7f1fac2d13f0 <unknown>
#19 0x7f1fac2d149c g_main_context_iteration
#20 0x000001e4ded6 <unknown>
#21 0x000001e8d41e <unknown>
#22 0x0000026fd569 <unknown>
#23 0x0000026fd3b5 <unknown>
#24 0x00000270023d <unknown>
#25 0x0000026f93ec <unknown>
#26 0x000001221af7 <unknown>
#27 0x0000012205d0 <unknown>
#28 0x000003479633 main
#29 0x7f1fa9edb830 __libc_start_main
#30 0x000000579189 <unknown>
  r8: 000000000000fff8  r9: 000000000000001c r10: 0000003d1409b4a0 r11: 00007f1faa04f390
 r12: 0000000000000000 r13: 0000000000000000 r14: 0000003d1424d2c0 r15: 0000003d1424d2c0
  di: 0000000000000000  si: 0000003d141e6040  bp: 00007ffe34f74901  bx: 0000000000000000
  dx: 0000000000000000  ax: 0000000000000000  cx: 0000003d141e6060  sp: 00007ffe34f74680
  ip: 000000000329c109 efl: 0000000000010246 cgf: 0000000000000033 erf: 0000000000000004
 trp: 000000000000000e msk: 0000000000000000 cr2: 0000000000000018
[end of stack trace]
@ns ns changed the title Segmentation fault with offscreen Segmentation fault when offscreen= true on ubuntu Feb 6, 2017
@ns ns changed the title Segmentation fault when offscreen= true on ubuntu Segmentation fault when offscreen=true on ubuntu Feb 6, 2017
@kevinsawicki
Copy link
Contributor

Here is the stack trace with more symbols:

Received signal 11 SEGV_MAPERR 000000000078
#0 0x7f41d603bd07 <unknown>
#1 0x7f41cca29390 <unknown>
#2 0x7f41d966d638 aura::Window::AddChild()
#3 0x7f41ddb4f801 content::BrowserPluginGuest::InitInternal()
#4 0x7f41ddb54a52 content::BrowserPluginGuest::OnWillAttachComplete()
#5 0x000000a898bb base::internal::RunMixin<>::Run()
#6 0x000000d2754e atom::WebViewGuestDelegate::WillAttach()
#7 0x7f41ddb54947 content::BrowserPluginGuest::Attach()
#8 0x7f41ddb4eafc <unknown>
#9 0x7f41ddb4ea44 content::BrowserPluginEmbedder::OnMessageReceived()
#10 0x7f41ddea5a3c content::WebContentsImpl::OnMessageReceived()
#11 0x7f41ddc30ef8 content::RenderFrameHostImpl::OnMessageReceived()
#12 0x7f41da588ac5 IPC::ChannelProxy::Context::OnDispatchMessage()
#13 0x7f41d603ccee base::debug::TaskAnnotator::RunTask()

@kevinsawicki
Copy link
Contributor

This also happens on Windows as well.

@kevinsawicki kevinsawicki changed the title Segmentation fault when offscreen=true on ubuntu Crash with offscreen webview on Linux/WIndows Feb 22, 2017
@kevinsawicki kevinsawicki changed the title Crash with offscreen webview on Linux/WIndows Crash with offscreen webview on Linux/Windows Feb 22, 2017
@kevinsawicki
Copy link
Contributor

@gerhardberger @brenca any ideas on this one?

@gerhardberger
Copy link
Contributor

could you provide a sample code that reproduces this issue?

also, I'm not sure, but it looks like you are trying to offscreen render a <webview> element, which probably is created as a child window (based on the more detailed log) which is not supported currently by offscreen rendering.

@kevinsawicki
Copy link
Contributor

could you provide a sample code that reproduces this issue?

index.js

const {app, BrowserWindow} = require('electron')

let win

app.once('ready', () => {
  win = new BrowserWindow({
    webPreferences: {
      offscreen: true
    }
  })
  win.loadURL(`file://${__dirname}/index.html`)
  win.webContents.on('paint', (event, dirty, image) => {
    console.log('paint')
  })
  win.webContents.setFrameRate(30)
})

index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <webview src="https://github.com"></webview>
  </body>
</html>

@gerhardberger
Copy link
Contributor

it works fine on macOS, @brenca will check it out on Windows soon!

@kevinsawicki
Copy link
Contributor

it works fine on macOS, @brenca will check it out on Windows soon!

Yeah, I only see the crash on Linux and Windows.

@brenca brenca self-assigned this Mar 1, 2017
@brenca
Copy link
Contributor

brenca commented Mar 1, 2017

After some digging, this seems to be something I can only solve with a libchromiumcontent patch (these lines are missing in the current state). Working on a fix.

@tluyben
Copy link

tluyben commented Mar 11, 2017

I am getting segfaults as well; could it be related or should I open a separate issue? (Ubuntu as well this, but the URLs it crashes on do not seem to have popups but they do work in offscreen=false mode).

[996571.764538] electron[1808]: segfault at b8 ip 00007f14d7ac7e94 sp 00007ffe8755daf0 error 4 in libGL.so.1.2.0[7f14d7aa8000+70000]
[996571.804370] electron[1819]: segfault at b8 ip 00007fdc865b0e94 sp 00007fff2135ef50 error 4 in libGL.so.1.2.0[7fdc86591000+70000]
[996571.812756] electron[1807]: segfault at b8 ip 00007fd513b91e94 sp 00007ffead7f9f70 error 4 in libGL.so.1.2.0[7fd513b72000+70000]
[996571.963285] electron[1922]: segfault at b8 ip 00007f9e1af2ce94 sp 00007ffe14cab890 error 4 in libGL.so.1.2.0[7f9e1af0d000+70000]
[996579.773256] electron[2103]: segfault at b8 ip 00007f6fc1813e94 sp 00007ffedd5107d0 error 4 in libGL.so.1.2.0[7f6fc17f4000+70000]
[996579.781093] electron[2086]: segfault at b8 ip 00007f81bf225e94 sp 00007ffda3ff6e90 error 4 in libGL.so.1.2.0[7f81bf206000+70000]
[996579.919006] electron[2153]: segfault at b8 ip 00007fc1077d5e94 sp 00007ffdd851a440 error 4 in libGL.so.1.2.0[7fc1077b6000+70000]
[996579.923835] electron[2151]: segfault at b8 ip 00007fcca575de94 sp 00007fff3e1df790 error 4 in libGL.so.1.2.0[7fcca573e000+70000]
[996579.940001] electron[2172]: segfault at b8 ip 00007ff6b914ee94 sp 00007ffc4b3e48f0 error 4 in libGL.so.1.2.0[7ff6b912f000+70000]
[996579.944083] electron[2166]: segfault at b8 ip 00007fd789026e94 sp 00007ffdac17dce0 error 4 in libGL.so.1.2.0[7fd789007000+70000]

@brenca
Copy link
Contributor

brenca commented Mar 12, 2017

@tluyben Do you have a webview in offscreen mode as well? If yes, this will solve your crash too, hopefully. If you want, I can test the URLs you need with my local build to see if it crashes (I'm on windows, but the window subsystem is the same on linux and windows in chromium afaik)

@tluyben
Copy link

tluyben commented Mar 13, 2017

@brenca I am running nightmarejs which uses Electron. In debug mode it does not crash while in headless mode it does crash on some URLs. I will try to compile a list as well.

@jg123
Copy link

jg123 commented Sep 20, 2017

@brenca I was getting similar core dumps as @tluyben running electron 1.7.6 through nightmare. It was opening www.yahoo.com. The fix in my case was toapt install ttf-freefont. Also, if I don't set the xvfb screen color depth to 24 (default is 8), it would still segfault, but everything would still work and the execution would complete successfully.

My final command-line is
xvfb-run --server-args="-screen 0 1024x768x24" node node_modules/nightmare/example.js

Fix found here: wechaty/wechaty#235 (comment)

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

Successfully merging a pull request may close this issue.

8 participants