How to catch "Error: EBUSY: resource busy or locked, open 'foo_bar.csv'

2,481 views
Skip to first unread message

Michael Bergmann

unread,
Feb 20, 2018, 10:13:40 AM2/20/18
to Node-RED
Hi everyone,

I am developing an application where I have to read a CSV file. This file is the basis for further analysis. Unfortunately my program isn't the only one who is trying to read from this specific file. I suppose that's why I get the following error:

Error: EBUSY: resource busy or locked, open 'foo_bar.csv'

 This error occurs rarely - let's say one time a day - but the time between failures seems to be random. But that's not the point.

I am using the node-red watch module to recognise any chances on the file. The watch module is followed by some functions, which are not touching the file. Then I am using the csvtojson module from "node-red-contrib-csvtojson". this is the only module touching the file directly. I am loading the content of the file into a JavaScript object and I am working only with this object. When the error occurs node-red crashes and is exited.  I have to restart node red manuelly.

So here is my question: how can I catch this error so that the Programm doesn't crash? Ideally the flow would take a short break and try's the hole thing again some seconds later. The error catching module from node red is not working on this particular error

Thank you very mutch.

Michael

Dave C-J

unread,
Feb 20, 2018, 1:08:18 PM2/20/18
to node...@googlegroups.com
Well the node should catch it and handle it so please report it to the author of that node.

Alternatively use the built in file read node and the built in csv node to parse it... or is there some feature of that node that requires you to use it ?

Michael Bergmann

unread,
Feb 21, 2018, 1:55:10 AM2/21/18
to Node-RED


Am Dienstag, 20. Februar 2018 19:08:18 UTC+1 schrieb Dave C-J:
Well the node should catch it and handle it so please report it to the author of that node.

Alternatively use the built in file read node and the built in csv node to parse it... or is there some feature of that node that requires you to use it ?

Hi Dave,

thanks for your answer. Well in that named node I can specify a filename and filepath which file to read via msg.filename. That is a little more comfortable than the build in nodes. But you are right, the file read and csv node should do the trick. I will try it - thanks!

Greetings Michael
Reply all
Reply to author
Forward
0 new messages