EMFILE: too many open files ..main.js

User avatar
magnussandstrom
Advanced member
Posts: 447
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

Re: EMFILE: too many open files ..main.js

Post by magnussandstrom »

JaDe0051 wrote: Tue Mar 26, 2024 1:33 pm In our case it was the default app inject job. We reinstalled the older Version of the app. It solved the problem.
Great info, thanks!

Enfocus are you planning an update for Inject jobs app?
User avatar
JimmyHartington
Advanced member
Posts: 365
Joined: Tue Mar 22, 2011 7:38 am

Re: EMFILE: too many open files ..main.js

Post by JimmyHartington »

I updated to version 12 of Inject Job yesterday.
And then I got the EMFILE error for an Inject Job element.

But does this error show up if just one app has the problem?
So the amount of temp-files limit is for the Switch-installation?
Arthur
Member
Posts: 114
Joined: Sat Sep 09, 2017 11:58 pm
Location: Yateley, UK

Re: EMFILE: too many open files ..main.js

Post by Arthur »

In our case it was about 3 apps:
1. Inject Job
2. XML Pickup
3. Archive.
Not sure which one caused the isssue, but am downgrading them to the latest working version.
Other native apps which already transitioned to Node.JS we installed without issues and the processing speed was greatly improved compared to respective legacy versions. So based on this "improved" experience I decided to get the above 3 updated, as they are used a lot. So thought this might also speed processing up a bit.
Yet instead of improvement it made the whole thing unusable LOL.
More restrictive quality check needed at Enfocus. not the speed in releasing new apps, but the quality, so that systems in production were not so severely impacted as is the case here.
User avatar
JimmyHartington
Advanced member
Posts: 365
Joined: Tue Mar 22, 2011 7:38 am

Re: EMFILE: too many open files ..main.js

Post by JimmyHartington »

It seems like more bugs or regressions has slipped into the app releases lately.
I know the apps are available for beta testing before release. But as I recall it is not possible to run the beta version and a regular version on the same Switch installation.
If that was possible I would be more willing to test the apps before installing them.
User avatar
magnussandstrom
Advanced member
Posts: 447
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

Re: EMFILE: too many open files ..main.js

Post by magnussandstrom »

JimmyHartington wrote: Tue Apr 16, 2024 10:43 pm It seems like more bugs or regressions has slipped into the app releases lately.
I know the apps are available for beta testing before release. But as I recall it is not possible to run the beta version and a regular version on the same Switch installation.
If that was possible I would be more willing to test the apps before installing them.
Or Enfocus could provide a free Switch dev-license for beta testers. To test beta apps on a production system is not fun and very time consuming for us users.
User avatar
JimmyHartington
Advanced member
Posts: 365
Joined: Tue Mar 22, 2011 7:38 am

Re: EMFILE: too many open files ..main.js

Post by JimmyHartington »

magnussandstrom wrote: Wed Apr 17, 2024 9:19 am Or Enfocus could provide a free Switch dev-license for beta testers. To test beta apps on a production system is not fun and very time consuming for us users.
Agreed. This could solve it as well.
User avatar
Terkelsen
Advanced member
Posts: 313
Joined: Thu Sep 08, 2011 5:08 pm
Contact:

Re: EMFILE: too many open files ..main.js

Post by Terkelsen »

I'm having the same problem but in this case I can only find "Refresh job info" to blame, and there is no way to neither up- nor downgrade that :roll:
User avatar
magnussandstrom
Advanced member
Posts: 447
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

Re: EMFILE: too many open files ..main.js

Post by magnussandstrom »

Terkelsen wrote: Wed Apr 17, 2024 9:56 am I'm having the same problem but in this case I can only find "Refresh job info" to blame, and there is no way to neither up- nor downgrade that :roll:
I'm using "Refresh job info (4.0)" and do not have any EMFILE-issues with that specific app.
mkayyyy
Member
Posts: 87
Joined: Mon Nov 21, 2016 6:31 pm
Location: UK

Re: EMFILE: too many open files ..main.js

Post by mkayyyy »

JimmyHartington wrote: Wed Apr 17, 2024 9:23 am
magnussandstrom wrote: Wed Apr 17, 2024 9:19 am Or Enfocus could provide a free Switch dev-license for beta testers. To test beta apps on a production system is not fun and very time consuming for us users.
Agreed. This could solve it as well.
This X10000
User avatar
magnussandstrom
Advanced member
Posts: 447
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

Re: EMFILE: too many open files ..main.js

Post by magnussandstrom »

For anyone struggeling with this issue Enfocus support says:

Hello Magnus,

Indeed some of the last app versions may be affected by that problem. On the good side i's like to share that the problem has been already investigated and resolved. The next version release will contain a fix this problem permanently.

sorry for the inconvenience
Kind Regards
Enfocus Support
User avatar
JimmyHartington
Advanced member
Posts: 365
Joined: Tue Mar 22, 2011 7:38 am

Re: EMFILE: too many open files ..main.js

Post by JimmyHartington »

I just got the ECONNRESET error for five flows, where no files was being processed. This was on the XML Pickup app.

But Switch was processing files in another flow, which uses a script I have developed.

The script reads a file and sets Private Data.
So I do not create any temp files or anything.
But is there anything I should be aware of which could perhaps create trouble for other apps?

Here is the error:

Code: Select all

External process failed
Flow: Skabertrang - Brandstore output
Flow element: XML pickup
Module: XML pickup
Job:
Time: 2024-04-24 09:18:16
Message: read ECONNRESET
Error: read ECONNRESET
    at _0x41b73f.get (C:\Program Files\Enfocus\Enfocus Switch\ScriptExecutor\nodemodules\node_modules\switch-scripting\index.js:1120:27)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async timerFired (C:\Users\flow-admin\AppData\Roaming\Enfocus\SwitchProcessorService\cache\63f2e35b913372b19b6be5adc3c4a84dc53391999d8b9dae4f6c48b54a270fdb\1708687644\main.js:1:8004)
    at async _0x12b34a (C:\Program Files\Enfocus\Enfocus Switch\ScriptExecutor\nodemodules\node_modules\switch-scripting\index.js:1331:24)
    at async C:\Users\flow-admin\AppData\Roaming\Enfocus\SwitchProcessorService\cache\63f2e35b913372b19b6be5adc3c4a84dc53391999d8b9dae4f6c48b54a270fdb\1708687644\main.js:1:20672
And here is my script:

Code: Select all

import * as fs from "fs";

async function jobArrived(s: Switch, flowElement: FlowElement, job: Job) {

    let jobPath: string = await job.get(AccessLevel.ReadOnly) as string;
    let inputFileText = await fs.readFileSync(jobPath, "utf-8").trim();

    let arrData = [];

    // await job.log(LogLevel.Info, "Filecontent: " + inputFileText);
    
    arrData = await inputFileText.split("\n");
    arrData.length = await 10;
    
    for( var i =0;i < arrData.length; i++) {
		
		// Set to PD
		let arrDataLine = [];
		arrDataLine = await arrData[i].split(";");
		let prefix = await i+1
		await job.setPrivateData(prefix+"-strFMDnumber", arrDataLine[0]);
		await job.setPrivateData(prefix+"-strBarcodestring", arrDataLine[1]);
		await job.setPrivateData(prefix+"-strFMDline01", arrDataLine[2]);
		await job.setPrivateData(prefix+"-strFMDline02", arrDataLine[3]);
		await job.setPrivateData(prefix+"-strFMDline03", arrDataLine[4]);
		await job.setPrivateData(prefix+"-strFMDline04", arrDataLine[5]);
		await job.setPrivateData(prefix+"-strFMDline05", arrDataLine[6]);
		await job.setPrivateData(prefix+"-strFMDline06", arrDataLine[7]);
        
		// Log PD
		await job.log(LogLevel.Info, "PD: " + prefix+ "-strFMDnumber:" + arrDataLine[0]);
		await job.log(LogLevel.Info, "PD: " + prefix+ "-strBarcodestring:" + arrDataLine[1]);
		await job.log(LogLevel.Info, "PD: " + prefix+ "-strFMDline01:" + arrDataLine[2]);
		await job.log(LogLevel.Info, "PD: " + prefix+ "-strFMDline02:" + arrDataLine[3]);
		await job.log(LogLevel.Info, "PD: " + prefix+ "-strFMDline03:" + arrDataLine[4]);
		await job.log(LogLevel.Info, "PD: " + prefix+ "-strFMDline04:" + arrDataLine[5]);
		await job.log(LogLevel.Info, "PD: " + prefix+ "-strFMDline05:" + arrDataLine[6]);
		await job.log(LogLevel.Info, "PD: " + prefix+ "-strFMDline06:" + arrDataLine[7]);
		
	}

    await job.sendToData(Connection.Level.Success);
}
laurentd
Member
Posts: 153
Joined: Wed Mar 13, 2019 2:06 pm

Re: EMFILE: too many open files ..main.js

Post by laurentd »

For us, it was strongly tied to the app "PDF review reporter" with multiple customer for which we created a flow with loop inside switch.
By reducing the frequency of the loop + planned restart, we have diminished the frequency of the problem with our customer.
I just published v8 of PDF Review Module Reporter app, to fix the problem.
Of course it can still happen with other scripts or apps using the tmp package without the {discardDescriptor: true} option.
This is also something we now check when reviewing new apps.
Laurent De Wilde, Solution Architect @ Enfocus
Post Reply