Windows 7 weirdness


#1

Hi all.

I must be doing something incredibly stupid. I have an Electron app that runs like the wind on OS X but can barely launch on Windows 7 (VirtualBox). I boiled the functionality down to a simple use case so I can hopefully get some help here.

main.js

var app = require('app');  // Module to control application life.
var BrowserWindow = require('browser-window');  // Module to create native browser window.
var request = require('request');
var ipc = require('ipc');

var mainWindow = null;

app.on('ready', function() {

  ipc.on('request', function(event) {
    request({
        url: "https://goo.gl/6QALvF",
        method: "GET"
    }, function (error, response, body){
        var json = JSON.parse(body);
        console.log(json.message);
        request({
            url: "https://goo.gl/5aG0yu",
            method: "GET"
        }, function (error, response, body){
            var json = JSON.parse(body);
            console.log(json.message);
            event.sender.send("response", json.message);
        });
    });
  })

  mainWindow = new BrowserWindow({width: 800, height: 600});
  mainWindow.loadUrl('file://' + __dirname + '/index.html');
});

index.html

<html>
  <body>
    <h1>Waiting for a response!</a>
  </body>
  <script>
  var ipc = require('ipc');
  ipc.on("response", function(data) {
      alert(data);
  })
  ipc.send('request');  
  </script>
</html>

Like I said, on OSX this runs and alerts almost immediately.
On Windows 7 this takes about 2 minutes.
Console output:

[2316:0825/133055:ERROR:gl_surface_egl.cc(485)] eglInitialize D3D11 failed with error UNKNOWN, trying next display type
[2504:0825/133055:INFO:renderer_main.cc(200)] Renderer process started
[2316:0825/133056:ERROR:gl_surface_egl.cc(485)] eglInitialize D3D9 failed with error UNKNOWN
[2316:0825/133056:ERROR:gl_surface_egl.cc(485)] eglInitialize D3D11 failed with error UNKNOWN, trying next display type
[2316:0825/133057:ERROR:gl_surface_egl.cc(485)] eglInitialize D3D9 failed with error UNKNOWN
[2316:0825/133057:ERROR:gl_surface_win.cc(171)] GLSurfaceEGL::InitializeOneOff failed.
[2316:0825/133057:ERROR:gpu_child_thread.cc(163)] Exiting GPU process due to errors during initialization
[2348:0825/133057:ERROR:browser_gpu_channel_host_factory.cc(139)] Failed to launch GPU process.
[2348:0825/133222:INFO:CONSOLE(0)] you have response #1
[2348:0825/133222:INFO:CONSOLE(0)] you have response #2

The VirtualBox is otherwise extremely snappy.I’m thinking it must be the problem but thought I would ask here before running out to buy a Windows machine :smile:


#2

Why are you splitting the request/response processing and display between the main and renderer process? Why not just do all of the work in the renderer?

See this topic where I talk about the splitting of code between the main process and the renderer process:


#3

Bingo! That was the problem - thanks a million!