Comments (14)
Can you please post some sort of stack trace, log or other information so that we know where in the code it's crashing? It may not even be crashing in NodeS7.
from nodes7.
unfortunately, i dont have access to the host-system where nodered shows the logs..
i just setup a new container https://hub.docker.com/r/hilschernetpi/netpi-nodered-fieldbus/
and the only thing i've installed in it was an ssh-server & nodeS7, but it crashed again after about 2minutes when i read out data..
from nodes7.
Are you able to get a stack trace or log from that new container?
from nodes7.
i'm very new to this all, but i installed stacktrace-js and got this output, no idea wether its helpful or not..
Function()@node:eeea8b0d.93ffa8:13:12
Function()@node:eeea8b0d.93ffa8:17:3
ContextifyScript.Script.runInContext()@vm.js:59:29
FunctionNode.()@/usr/lib/node_modules/node-red/nodes/core/core/80-function.js:224:33
emitOne()@events.js:116:13
FunctionNode.emit()@events.js:211:7
FunctionNode.Node.receive()@/usr/lib/node_modules/node-red/red/runtime/nodes/Node.js:215:14
InjectNode.Node.send()@/usr/lib/node_modules/node-red/red/runtime/nodes/Node.js:202:14
dont think so because the message dont change when the container crashes
from nodes7.
By stack trace I mean the console output when the node process crashes, if it's actually crashing rather than just stopping communicating with the PLC. Can you access the console output through the container somehow? Docker logs maybe?
from nodes7.
unfortunately, i cannot access the docker logs because the host system is secured and i only have access to the docker UI.
The communication doesnt stop instantly, first i get the same outputs several times and then the connection to node-red gets lost..
from nodes7.
Can't you run your program locally instead of the container for debugging purposes?
from nodes7.
I just saw that docker gives me an error, maybe you can tell me something about it..
DPM status changed 0xFF (OK => 0x11)!
Error SPIReadChunk: DPM Addr=0x200 / Len=0x4
but this only appears when starting the container..
from nodes7.
That is not the information we're after.
Please let us know if you can duplicate the issue locally. Do you have local access to a PLC? If so, install Node-RED and everything locally, in a Docker container or just on its own, and see if you can duplicate the problem that way.
from nodes7.
Yes I installed Node-Red in Windows and get the same issue..
[1576,703541400 192.168.222.5 S1] Attempting to connect to host...
[1576,706120599 192.168.222.5 S1] TCP Connection Established to 192.168.222.5 on port 102
[1576,707020700 192.168.222.5 S1] Will attempt ISO-on-TCP connection
[1576,707752300 192.168.222.5 S1] Using rack [0] and slot [1]
[1576,710439100 192.168.222.5 S1] ISO-on-TCP Connection Confirm Packet Received
16 Oct 09:05:13 - [red] Uncaught Exception:
16 Oct 09:05:13 - Error: write ECONNRESET
at _errnoException (util.js:992:11)
at Socket._writeGeneric (net.js:764:25)
at Socket._write (net.js:783:8)
at doWrite (_stream_writable.js:397:12)
at writeOrBuffer (_stream_writable.js:383:5)
at Socket.Writable.write (_stream_writable.js:290:11)
at Socket.write (net.js:707:40)
at NodeS7.onISOConnectReply (C:\Users\Administrator.node-red\node_modules\nodes7\nodeS7.js:315:17)
at Socket. (C:\Users\Administrator.node-red\node_modules\nodes7\nodeS7.js:271:26)
at emitOne (events.js:116:13)
from nodes7.
var nodes7 = global.get('nodes7'); // This is the package name, if the repository is cloned you may need to require 'nodeS7' with uppercase S
var conn = new nodes7();
var doneReading = false;
var doneWriting = false;
var variables = { TEST1: 'DB3,INT2.8' // Integer Array of 8 in DB3 at Offset 2
// TEST2: 'M32.2', // Bit at M32.2
// TEST3: 'M20.0', // Bit at M20.0
// TEST4: 'DB1,REAL0.20', // Array of 20 values in DB1
// TEST5: 'DB1,REAL4', // Single real value
// TEST6: 'DB1,REAL8', // Another single real value
// TEST7: 'DB1,INT12.2' // Two integer value array
};
conn.initiateConnection({port: 102, host: '192.168.222.5', rack: 0, slot: 1}, connected); // slot 2 for 300/400, slot 1 for 1200/1500
//conn.initiateConnection({port: 102, host: '192.168.0.2', localTSAP: 0x0100, remoteTSAP: 0x0200, timeout: 8000}, connected); // local and remote TSAP can also be directly specified instead. The timeout option specifies the TCP timeout.
function connected(err) {
if (typeof(err) !== "undefined") {
// We have an error. Maybe the PLC is not reachable.
console.log(err);
process.exit();
}
conn.setTranslationCB(function(tag) {return variables[tag];}); // This sets the "translation" to allow us to work with object names
conn.addItems(['TEST1']);
// conn.addItems('TEST6');
// conn.removeItems(['TEST2', 'TEST3']); // We could do this.
// conn.writeItems(['TEST5', 'TEST6'], [ 867.5309, 9 ], valuesWritten); // You can write an array of items as well.
// conn.writeItems('TEST7', [ 666, 777 ], valuesWritten); // You can write a single array item too.
conn.readAllItems(valuesReady);
}
function valuesReady(anythingBad, values) {
if (anythingBad) { console.log("SOMETHING WENT WRONG READING VALUES!!!!"); }
// node.error(values.TEST1);
flow.set("values",values.TEST1);
doneReading = true;
if (doneWriting) { process.exit(); }
}
function valuesWritten(anythingBad) {
if (anythingBad) { console.log("SOMETHING WENT WRONG WRITING VALUES!!!!"); }
console.log("Done writing.");
doneWriting = true;
if (doneReading) { process.exit(); }
}
msg.payload = flow.get("values");
return msg;
from nodes7.
Are you putting this code inside a function node on Node-RED? Please note that the whole code is executed on every incoming message. This means you're creating a new connection on every message, without cleaning up the old one. So you end up using all the connection resources of the PLC and it won't accept new connections, that's why you're getting the ECONNRESET
.
Why don't you use the node-red-contrib-s7 node? It uses this library and handles all the details for you.
from nodes7.
Okey thank you, then thats the problem..
I wont use contrib-s7 because my DB addresses are variable and read out from another document..
I know i can upload an csv file but that should be automated so I'm using the code in a function for easy handling
could i simply add dropConnection() to the end of my function?
from nodes7.
Adding dropConnection()
may do it there. But take care not run
Another (maybe cleaner) solution in your case would be to create a separate executable, where you can pass the variables over command line arguments or stdin, and then call it using the "exec" node, so you don't have this giant function in Node-RED.
from nodes7.
Related Issues (20)
- .dropConnection callback is fired to early
- Question: How to check the connection status?
- force output to activate a relay HOT 1
- Not working with nuxt HOT 1
- Need help for tags / address associations G120C drive HOT 12
- [Question] Read boolean value from DB HOT 1
- boolen write problem ??? HOT 11
- Read single item HOT 3
- Address conversion HOT 1
- TCP ECCONRESET HOT 11
- ECONNRESET Nodered HOT 1
- Reading big offsets
- readAllItems and writeItems stopped when is waiting HOT 1
- support for 64 bit data type
- Server functionality
- ISOonTCP RFC 1006 telergrams
- Reading NC Variables from Sinumerik 840d
- Optimized block access HOT 1
- I want to know how to use the 'values' to vue component's data HOT 1
- Tries to connect to a PLC with wrong IP address, never returns error, always tries to reconnect
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nodes7.