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

Not working in packed electron >=17.3 #74

Closed
hrueger opened this issue Dec 2, 2022 · 6 comments · Fixed by #75
Closed

Not working in packed electron >=17.3 #74

hrueger opened this issue Dec 2, 2022 · 6 comments · Fixed by #75

Comments

@hrueger
Copy link
Contributor

hrueger commented Dec 2, 2022

Hi,
continuing here from nrkno/sofie-atem-connection#133.
TLDR:

  • Using electron@20 and threadedclass@1.2.0
  • Using atem-connection which internally uses threadedclass
  • Everything works fine if started with node . or electron .
  • Not working if the application is packed (using electron-builder)
  • Probably not a bundler issue as the node_modules folder is not touched

After digging a bit into the code (and rebuilding the installer every time to test changes), I found that somehow:

  • this promise never completes. It does not resolve nor reject
  • I added console.log statements (using a debugger is difficult since the app needs to be packed for the bug to happen) to all the event listeners here.
Details
        this.worker.on('message', (message) => {
            console.log("--------------> Worker thread received message");
            this.emit('message', message);
            // if (message.type === 'message') {
            // } else console.log('unknown message type', message)
        });
        this.worker.on('messageerror', (error) => {
            console.log("--------------> Worker thread received message error", error);
            this.emit('error', error);
        });
        this.worker.on('error', (error) => {
            console.log("--------------> Worker thread received error", error);
            this.emit('error', error);
        });
        this.worker.on('exit', (_code) => {
            console.log("--------------> Worker thread received exit");
            this.emit('close');
        });
        this.worker.on('close', () => {
            console.log("--------------> Worker thread received close");
            this.emit('close');
        });
  • Using that, I found that the worker threads always exit immediately:
--------------> Worker thread received error [worker eval]:1
!function(){return function e(t,r,n){function i(o,a){if(!r[o]){if(!t[o]){var c="function"==typeof require&&require;if(!a&&c)return c(o,!0);if(s)return s(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var f=r[o]={exports:{}};t[o][0].call(f.exports,function(e){return i(t[o][1][e]||e)},f,f.exports,e,t,r,n)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}}()({1:[function(e,t,r){const{register:n,addAsarToLookupPaths:i}=e("asar-node");n(),i();const s=e("worker_threads");if(!s.workerData)throw new Error("Missing workerData defining path to load");e(s.workerData)},{"asar-node":2,worker_threads:void 0}],2:[function(e,t,r){const n=e("./lib/lookup.js"),i=e("./lib/register.js");r.addAsarToLookupPaths=n.addAsarToLookupPaths,r.register=i.register,r.getState=function(){return{lookupAsar:n.checkLookupState(),registered:i.checkRegisterState()}}},{"./lib/lookup.js":5,"./lib/register.js":7}],3:[function(e,t,r){const n=e("./require.js")(),i=e("path"),s=process.versions.electron?n("original-fs"):e("fs"),o=e("./pickle");class a{constructor(e){this.src=i.resolve(e),this.header={files:{}}}searchNodeFromDirectory(e){let t=this.header;const r=e.split(i.sep);for(const e of r)"."!==e&&(t=t.files[e]);return t}searchNodeFromPath(e){if(!(e=i.relative(this.src,e)))return this.header;const t=i.basename(e),r=this.searchNodeFromDirectory(i.dirname(e));return null==r.files&&(r.files={}),null==r.files[t]&&(r.files[t]={}),r.files[t]}insertDirectory(e,t){const r=this.searchNodeFromPath(e);return t&&(r.unpacked=t),r.files={},r.files}listFiles(e){const t=[],r=function(n,s){if(s.files)return(()=>{const o=[];for(const a in s.files){const c=i.join(n,a),u=!0===s.files[a].unpacked?"unpack":"pack  ";t.push(e&&e.isPack?`${u} : ${c}`:c),o.push(r(c,s.files[a]))}return o})()};return r("/",this.header),t}getNode(e){const t=this.searchNodeFromDirectory(i.dirname(e)),r=i.basename(e);return r?t.files[r]:t}getFile(e,t){t=void 0===t||t;const r=this.getNode(e);return r.link&&t?this.getFile(r.link):r}}let c={};function u(e){if(!c[e]){const t=function(e){const t=s.openSync(e,"r");let r,n;try{const e=Buffer.alloc(8);if(8!==s.readSync(t,e,0,8,null))throw new Error("Unable to read header size");if(r=o.createFromBuffer(e).createIterator().readUInt32(),n=Buffer.alloc(r),s.readSync(t,n,0,r,null)!==r)throw new Error("Unable to read header")}finally{s.closeSync(t)}const i=o.createFromBuffer(n).createIterator().readString();return{header:JSON.parse(i),headerSize:r}}(e),r=new a(e);r.header=t.header,r.headerSize=t.headerSize,c[e]=r}return c[e]}r.extractFile=function(e,t){const r=u(e);return function(e,t,r){let n=Buffer.alloc(r.size);if(r.size<=0)return n;if(r.unpacked)n=s.readFileSync(i.join(`${e.src}.unpacked`,t));else{const t=s.openSync(e.src,"r");try{const i=8+e.headerSize+parseInt(r.offset);s.readSync(t,n,0,r.size,i)}finally{s.closeSync(t)}}return n}(r,t,r.getFile(t))},r.statFile=function(e,t,r){return u(e).getFile(t,r)},r.disk={readFilesystemSync:u}},{"./pickle":6,"./require.js":8,fs:void 0,path:void 0}],4:[function(e,t,r){const n=e("./require.js")(),i=process.versions.electron?n("original-fs"):e("fs"),s=e("./asar.js"),o=s.disk,a=e("path"),c=e("./pickle"),{splitPath:u}=e("./util.js");let f=0;const d=null!=process.getuid?process.getuid():0,l=null!=process.getgid?process.getgid():0,h=new Date,p=e=>{const t=!e.files;return{dev:1,ino:++f,mode:33188,nlink:1,uid:d,gid:l,rdev:0,atime:e.atime||h,birthtime:e.birthtime||h,mtime:e.mtime||h,ctime:e.ctime||h,size:e.size,isFile:()=>t,isDirectory:()=>!t,isSymbolicLink:()=>!1,isBlockDevice:()=>!1,isCharacterDevice:()=>!1,isFIFO:()=>!1,isSocket:()=>!1}},y=i.readFileSync;i.readFileSync=function(e,t){const[r,n,i]=u(e);if(!r||""===i)return y.apply(this,arguments);if(t){if("string"==typeof t)t={encoding:t,flag:"r"};else if("object"!=typeof t)throw new TypeError("Bad arguments")}else t={encoding:null,flag:"r"};let o;try{o=s.extractFile(n,i)}catch(t){throw new Error("ENOENT: no such file or directory, open '"+e+"'")}return t.encoding?o.toString(t.encoding):o};const S=i.createReadStream;i.createReadStream=function(e,t){if(!e||t&&t.fd)return S.apply(this,arguments);const[r,n,o]=u(e);if(!r||""===o)return S.apply(this,arguments);const a=i.openSync(n,"r"),f=Buffer.alloc(8);if(8!==i.readSync(a,f,0,8,null))throw new Error("Unable to 
read header size");let d,l=c.createFromBuffer(f).createIterator().readUInt32();try{d=s.statFile(n,o)}catch(t){throw new Error("Not found '"+e+"'")}let h={fd:a,autoClose:!0,start:8+l+parseInt(d.offset,10),end:8+l+parseInt(d.offset,10)+d.size-1};return"[object Object]"===Object.prototype.toString.call(t)?("number"==typeof t.end&&(h.end=h.start+t.end,delete t.end),"number"==typeof t.start&&(h.start+=t.start,delete t.start),t=Object.assign({},h,t)):t=h,S("",t)};const w=i.statSync;i.statSync=function(e){const[t,r,n]=u(e);return t&&""!==n?p(s.statFile(r,n,!0)):w.apply(this,arguments)};const m=i.lstatSync;i.lstatSync=function(e){const[t,r,n]=u(e);return t&&""!==n?p(s.statFile(r,n)):m.apply(this,arguments)};const x=i.readdirSync;i.readdirSync=function(e){const[t,r,n]=u(e);if(!t)return x.apply(this,arguments);const i=o.readFilesystemSync(r);let s;try{if(!(s=i.getNode(n)))throw new Error}catch(t){throw new Error("ENOENT: no such file or directory, asar readdirSync '"+e+"'")}if(s.files)return Object.keys(s.files);throw new Error("ENOTDIR: not a directory, asar readdirSync '"+e+"'")};const j=i.existsSync;i.existsSync=function(e){const[t,r,n]=u(e);if(!t||""===n)return j.apply(this,arguments);try{return s.statFile(r,n),!0}catch(e){return!1}};const g=i.realpathSync;i.realpathSync=function(e){let[t,r,n]=u(e);if(!t||""===n)return 
g.apply(this,arguments);const i=s.statFile(r,n);return i.link&&(n=i.link),a.join(g(r),n)},t.exports=i},{"./asar.js":3,"./pickle":6,"./require.js":8,"./util.js":9,fs:void 0,path:void 0}],5:[function(e,t,r){let n=!1;r.addAsarToLookupPaths=function(){if(n)return;let t;try{t=e("module")}catch(e){t=null}if(t&&"function"==typeof t._resolveLookupPaths){const r=function(t){for(let r=0;r<t.length;r++)"node_modules"===e("path").basename(t[r])&&(t.splice(r+1,0,t[r]+".asar"),r++)},i=t._resolveLookupPaths;t._resolveLookupPaths=2===i.length?function(e,t){const n=i.call(this,e,t);return n?(r(n),n):n}:function(e,t,n){const s=i.call(this,e,t,n),o=n?s:s[1];return r(o),s},n=!0}},r.checkLookupState=function(){return n}},{module:void 0,path:void 0}],6:[function(e,t,r){var n=function(e,t){return e+(t-e%t)%t},i=function(){function e(e){this.payload=e.header,this.payloadOffset=e.headerSize,this.readIndex=0,this.endIndex=e.getPayloadSize()}return e.prototype.readBool=function(){return 0!==this.readInt()},e.prototype.readInt=function(){return this.readBytes(4,Buffer.prototype.readInt32LE)},e.prototype.readUInt32=function(){return this.readBytes(4,Buffer.prototype.readUInt32LE)},e.prototype.readInt64=function(){return this.readBytes(8,Buffer.prototype.readInt64LE)},e.prototype.readUInt64=function(){return this.readBytes(8,Buffer.prototype.readUInt64LE)},e.prototype.readFloat=function(){return this.readBytes(4,Buffer.prototype.readFloatLE)},e.prototype.readDouble=function(){return this.readBytes(8,Buffer.prototype.readDoubleLE)},e.prototype.readString=function(){return this.readBytes(this.readInt()).toString()},e.prototype.readBytes=function(e,t){var r=this.getReadPayloadOffsetAndAdvance(e);return null!=t?t.call(this.payload,r,e):this.payload.slice(r,r+e)},e.prototype.getReadPayloadOffsetAndAdvance=function(e){if(e>this.endIndex-this.readIndex)throw this.readIndex=this.endIndex,new Error("Failed to read data with length of "+e);var t=this.payloadOffset+this.readIndex;return this.advance(e),t},e.prototype.advance=function(e){var t=n(e,4);this.endIndex-this.readIndex<t?this.readIndex=this.endIndex:this.readIndex+=t},e}(),s=function(){function e(e){e?this.initFromBuffer(e):this.initEmpty()}return e.prototype.initEmpty=function(){this.header=Buffer.alloc(0),this.headerSize=4,this.capacityAfterHeader=0,this.writeOffset=0,this.resize(64),this.setPayloadSize(0)},e.prototype.initFromBuffer=function(e){this.header=e,this.headerSize=e.length-this.getPayloadSize(),this.capacityAfterHeader=9007199254740992,this.writeOffset=0,this.headerSize>e.length&&(this.headerSize=0),this.headerSize!==n(this.headerSize,4)&&(this.headerSize=0),0===this.headerSize&&(this.header=Buffer.alloc(0))},e.prototype.createIterator=function(){return new i(this)},e.prototype.toBuffer=function(){return this.header.slice(0,this.headerSize+this.getPayloadSize())},e.prototype.writeBool=function(e){return this.writeInt(e?1:0)},e.prototype.writeInt=function(e){return this.writeBytes(e,4,Buffer.prototype.writeInt32LE)},e.prototype.writeUInt32=function(e){return this.writeBytes(e,4,Buffer.prototype.writeUInt32LE)},e.prototype.writeInt64=function(e){return this.writeBytes(e,8,Buffer.prototype.writeInt64LE)},e.prototype.writeUInt64=function(e){return this.writeBytes(e,8,Buffer.prototype.writeUInt64LE)},e.prototype.writeFloat=function(e){return this.writeBytes(e,4,Buffer.prototype.writeFloatLE)},e.prototype.writeDouble=function(e){return this.writeBytes(e,8,Buffer.prototype.writeDoubleLE)},e.prototype.writeString=function(e){var t=Buffer.byteLength(e,"utf8");return!!this.writeInt(t)&&this.writeBytes(e,t)},e.prototype.setPayloadSize=function(e){return this.header.writeUInt32LE(e,0)},e.prototype.getPayloadSize=function(){return this.header.readUInt32LE(0)},e.prototype.writeBytes=function(e,t,r){var i=n(t,4),s=this.writeOffset+i;s>this.capacityAfterHeader&&this.resize(Math.max(2*this.capacityAfterHeader,s)),null!=r?r.call(this.header,e,this.headerSize+this.writeOffset):this.header.write(e,this.headerSize+this.writeOffset,t);var o=this.headerSize+this.writeOffset+t;return this.header.fill(0,o,o+i-t),this.setPayloadSize(s),this.writeOffset=s,!0},e.prototype.resize=function(e){e=n(e,64),this.header=Buffer.concat([this.header,Buffer.alloc(e)]),this.capacityAfterHeader=e},e}();r.createEmpty=function(){return new s},r.createFromBuffer=function(e){return new s(e)}},{}],7:[function(e,t,r){let n=!1;r.register=function(){if(n)return;let t;try{t=e("module")}catch(e){t=null}if(!t)return;const r=e("path"),i=e("./fs.js");if("function"==typeof t._resolveLookupPaths&&"function"==typeof t._findPath&&null!=t._extensions){const s=t._resolveLookupPaths;t._resolveLookupPaths=2===s.length?function(e,t){const r=s.call(this,e,t);return r?(r._parent=t,r):r}:function(e,t,r){const n=s.call(this,e,t,r);return n._parent=t,n};const{toAbsolute:a,splitPath:c}=e("./util.js"),u=t._findPath;t._findPath=function(e,t,n){const i=t?t._parent:null;t&&delete t._parent;const s=!!i&&!!i.filename&&-1!==i.filename.lastIndexOf(".asar");if(r.isAbsolute(e)||"."===e.charAt(0)){if(s)return r.isAbsolute(e)?o(e,e):o(e,a(r.join(".asar"===r.extname(i.filename)?i.filename:r.dirname(i.filename),e)))}else if(s){".asar"===i.filename.substr(-5)&&(t.unshift(r.join(i.filename,"node_modules.asar")),t.unshift(r.join(i.filename,"node_modules")));for(let n=0;n<t.length;n++){const i=r.join(t[n],e);try{return o(e,i)}catch(e){continue}}throw new Error("Cannot find module '"+e+"'")}const[f,d,l]=c(e);return f?""===l?a(d):o(e,a(e)):u.apply(this,arguments)},t._extensions[".asar"]=t._extensions[".asar"]||function e(n,s){const o=a(r.join(s,"package.json")),c=a(r.join(s,"index.js")),u=a(r.join(s,"index.json")),f=a(r.join(s,"index.node")),d=f.replace(/\.asar/,".asar.unpacked");if(i.existsSync(o)&&i.statSync(o).isFile()){const c=JSON.parse(i.readFileSync(o,"utf8"));c.main=c.main||"index";const u=a(r.join(s,c.main));if(""!==r.extname(u)){if(".node"===r.extname(u)){const e=u.replace(/\.asar/,".asar.unpacked");if(i.existsSync(e))return t._extensions[".node"](n,e)}else if(i.existsSync(u))return t._extensions[r.extname(u)](n,u);throw new Error("Cannot find module '"+s+"'")}if(i.existsSync(u+".js"))return t._extensions[".js"](n,u+".js");if(i.existsSync(u+".json"))return t._extensions[".json"](n,u+".json");if(i.existsSync(u+".node"))return t._extensions[".node"](n,u.replace(/\.asar/,".asar.unpacked")+".node");if(i.existsSync(u)&&i.statSync(u).isDirectory())return e(n,u);throw new Error("Cannot find module '"+s+"'")}if(i.existsSync(c)&&i.statSync(c).isFile())return t._extensions[".js"](n,c);if(i.existsSync(u)&&i.statSync(u).isFile())return t._extensions[".json"](n,u);if(i.existsSync(f)&&i.statSync(f).isFile()&&i.existsSync(d)&&i.statSync(d).isFile())return t._extensions[".node"](n,d);throw new Error("Cannot find module '"+s+"'")},n=!0}function s(e,t){const n=r.join(t,"package.json"),s=r.join(t,"index.js"),a=r.join(t,"index.json"),c=r.join(t,"index.node"),u=c.replace(/\.asar/,".asar.unpacked");if(i.existsSync(n)&&i.statSync(n).isFile()){const s=JSON.parse(i.readFileSync(n,"utf8"));return s.main=s.main||"index",o(e,r.join(t,s.main))}if(i.existsSync(s)&&i.statSync(s).isFile())return s;if(i.existsSync(a)&&i.statSync(a).isFile())return a;if(i.existsSync(c)&&i.existsSync(u)&&i.statSync(u).isFile())return u;throw new Error("Cannot find module '"+e+"'")}function o(e,t){if(!r.isAbsolute(t))throw new Error("Not absolute path.");if(""!==r.extname(t)&&i.existsSync(t)){if(i.statSync(t).isDirectory())return s(e,t);if(".node"===r.extname(t)){if(i.existsSync(t.replace(/\.asar/,".asar.unpacked"))&&i.statSync(t.replace(/\.asar/,".asar.unpacked")).isFile())return t.replace(/\.asar/,".asar.unpacked");throw new Error("Cannot find module '"+e+"'")}return t}if(i.existsSync(t+".js")&&i.statSync(t+".js").isFile())return t+".js";if(i.existsSync(t+".json")&&i.statSync(t+".json").isFile())return t+".json";if(i.existsSync(t+".node")&&i.statSync(t+".node").isFile()&&i.existsSync(t.replace(/\.asar/,".asar.unpacked")+".node")&&i.statSync(t.replace(/\.asar/,".asar.unpacked")+".node").isFile())return t.replace(/\.asar/,".asar.unpacked")+".node";if(i.existsSync(t)&&i.statSync(t).isDirectory())return s(e,t);throw new Error("Cannot find module '"+e+"'")}},r.checkRegisterState=function(){return n}},{"./fs.js":4,"./util.js":9,module:void 0,path:void 0}],8:[function(e,t,r){t.exports=function(){return"undefined"!=typeof __webpack_require__?"undefined"!=typeof __non_webpack_require__?__non_webpack_require__:void 0:void 0!==e?e:void 0}},{}],9:[function(e,t,r){const n=e("path"),i=e("./require.js")(),s=i.main?n.dirname(i.main.filename):process.cwd();r.toAbsolute=function(e){return n.isAbsolute(e)?e:-1===s.indexOf("asar-node"+n.sep+"bin")?n.join(s,e):n.join(process.cwd(),e)},r.splitPath=function(e){if("string"!=typeof e)return[!1];if(".asar"===e.substr(-5))return[!0,e,""];const t=e.lastIndexOf(".asar\\"),r=e.lastIndexOf(".asar/");if(-1===t&&-1===r)return[!1];const n=-1===r?t:r;return[!0,e.substr(0,n+5),e.substr(n+6)]}},{"./require.js":8,path:void 0}]},{},[1]);













Error: Cannot find module 'A:\_Source\GLUE\packages\release\win-unpacked\resources\app.asar\node_modules\threadedclass\dist\child-process\threadedclass-worker.js'
    at o ([worker eval]:1:13868)
    at t._findPath ([worker eval]:1:11173)
    at Module._resolveFilename (node:internal/modules/cjs/loader:926:27)
    at Module._load (node:internal/modules/cjs/loader:785:27)
    at c._load (node:electron/js2c/asar_bundle:5:13343)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at i ([worker eval]:1:132)
    at [worker eval]:1:306
    at 1.asar-node ([worker eval]:1:640)
--------------> Worker thread received exit
  • Interestingly, if I make it use the normal loaded and not the electron-specific loader, I get a different error:
--------------> Worker thread started
--------------> Worker thread received error RangeError [Error]: Maximum call stack size 
exceeded
    at ThreadedWorker.sendLog (A:\_Source\GLUE\packages\release\win-unpacked\resources\app.asar\node_modules\threadedclass\dist\child-process\worker.js:136:19)
    at Worker.log (A:\_Source\GLUE\packages\release\win-unpacked\resources\app.asar\node_modules\threadedclass\dist\child-process\worker.js:20:18)
    at send (A:\_Source\GLUE\packages\release\win-unpacked\resources\app.asar\node_modules\threadedclass\dist\child-process\threadedclass-worker.js:12:13)
    at ThreadedWorker.sendChildMessageToParent (A:\_Source\GLUE\packages\release\win-unpacked\resources\app.asar\node_modules\threadedclass\dist\child-process\threadedclass-worker.js:60:9)
    at ThreadedWorker.sendLog (A:\_Source\GLUE\packages\release\win-unpacked\resources\app.asar\node_modules\threadedclass\dist\child-process\worker.js:140:14)
    at Worker.log (A:\_Source\GLUE\packages\release\win-unpacked\resources\app.asar\node_modules\threadedclass\dist\child-process\worker.js:20:18)
    at send (A:\_Source\GLUE\packages\release\win-unpacked\resources\app.asar\node_modules\threadedclass\dist\child-process\threadedclass-worker.js:12:13)
    at ThreadedWorker.sendChildMessageToParent (A:\_Source\GLUE\packages\release\win-unpacked\resources\app.asar\node_modules\threadedclass\dist\child-process\threadedclass-worker.js:60:9)
    at ThreadedWorker.sendLog (A:\_Source\GLUE\packages\release\win-unpacked\resources\app.asar\node_modules\threadedclass\dist\child-process\worker.js:140:14)
    at Worker.log (A:\_Source\GLUE\packages\release\win-unpacked\resources\app.asar\node_modules\threadedclass\dist\child-process\worker.js:20:18)

I would see this as partly successfull, because the log line --------------> Worker thread started is being logged in the worker file at the very top. That means it should have loaded the worker now, right?

  • Maybe the Maximum call stack size exceeded is thrown due to my primitive way of logging. Still investigating

@Julusian any thoughts on that?

@hrueger
Copy link
Contributor Author

hrueger commented Dec 2, 2022

Although I didn't expect that to also happen in a minimal sample with just the atem-connection library, I was actually able to create a reproduction with less then 20 lines of code:
https://github.com/hrueger/threadedclass-issue-74
I hope that helps!

@hrueger
Copy link
Contributor Author

hrueger commented Dec 2, 2022

After some more investigation and trying out a lot of different electron versions, I can report that it breaks with electron version 17.3.0. The prior version, 17.2.0 works fine and all 17.x versions > 17.3 fail.

This makes sense, as in the release notes we can find the following:

Fix: initialize asar support in worker threads. #33395 (Also in 18)

That PR is a backport of electron/electron#33216 which changes the behaviour of asar support in worker threads.

That all makes sense now. Companion is using an electron version which is way lower than 17 and before it broke for me, I was using electron 17.2.0.

Hopefully someone knows how to fix this! I'm happy to test possible fixes or make a PR if someone points me in the right direction.

@Julusian
Copy link
Collaborator

Julusian commented Dec 2, 2022

I guess this is probably the hack I did for asar support

// Figure out the loader to use. This is to allow for some environment setup (eg require behaviour modification) before trying to run threadedClass
let loader = process.env.THREADEDCLASS_WORKERTHREAD_LOADER
if (!loader && isInAsar) {
loader = DEFAULT_ELECTRON_LOADER
}
is conflicting with the change in electron.

@hrueger
Copy link
Contributor Author

hrueger commented Dec 2, 2022

Yeah, I found that, too. I tried to disable that by just deleting those four lines. If you look at

Interestingly, if I make it use the normal loaded and not the electron-specific loader, I get a different error:

in the first comment and at the second code block, you can see that it did start the worker thread then, but the communication did not seem to work.

However, I just tried that in the reproduction repo and it works fine there. That means, I probably broke something in my application.

I guess I'll make a PR then which only uses the loader if the electron version is below 17.3.
We probably need to figure out if there are some 18.x versions which don't have that PR.

@Julusian
Copy link
Collaborator

Julusian commented Dec 2, 2022

@nytamin maybe at some point soon the DEFAULT_ELECTRON_LOADER should be removed and a semver major bump could be done? electron 19 is EOL now, so dropping support for those older versions isnt unreasonable.

@hrueger
Copy link
Contributor Author

hrueger commented Dec 2, 2022

According to the release notes electron 18.0.0 includes the fix already.

@nytamin nytamin changed the title Not working in packed electron Not working in packed electron >=17.3 Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants