Comments (6)
Hey @minzdrav, just wondering if that worked for you? Did you manage to run a client per thread without issue?
Hi @MatthijsvdVeer
Yes.
from bacnet.
Yup, can confirm the reads are not threadsafe. It has to do with InvokeId, a uint8 that gets added to every request like a correlation ID, it gets incremented every request, and if you send too many requests it can quickly roll over and cause problems.
Update: On further investigation the reads cause a thread to be blocked waiting for reply because of the use of ManualResetEvent
, this is actually a much bigger problem, as the non thread-safe client can be wrapped in a mutex, and multiple clients started in parallel, however, the reads will quickly eat up worker threads.
Fortunately a solution could be to replace ManualResetEvent
with a TaskCompletionSource
which doesn't block a thread. The rest of the code seems to be non-blocking which is great.
from bacnet.
Hi Guys,
I have same problem with https://github.com/ela-compil/BACnet/tree/v2-netstandard brunch.
Could you please try to fix?
from bacnet.
Unfortunatelly the client was not written to be thread safe. Try using a lock each time before you use it or write a wrapper that would do it for you for each atomic operation. Since BACnet operations have identifiers it should be possible to allow multiple requests to be sent out in the same time. I will leave this issue open to try to address it in the future.
from bacnet.
Hi @gralin
Thank you.
Yes, it's working fine with locks.
I have 1 thread per device and customer want to read properties and values from many devices. I'll try to create BACnet client per thread. Should work faster than locks.
from bacnet.
Hey @minzdrav, just wondering if that worked for you? Did you manage to run a client per thread without issue?
from bacnet.
Related Issues (20)
- problem with 'shared port' in bacnet ip/udp module HOT 1
- OutOfRangeException when sending big request HOT 3
- Setting up a notification class
- Trouble Publishing Due to Out-Of-Date Dependencies HOT 1
- Throws exception when parsing 'BacnetAddress' structure with broadcast mac address HOT 1
- IndexOutOfRangeException when calling BacnetClient.ReadPropertyResponse
- Setting `.DontFragment` on `UdpClient` on MacOS fails with an exception HOT 1
- SEGMENTATION NOT SUPPORTED WHEN REQUESTING DEVICE WITH MANY OBJECT PROPERTIES HOT 5
- Secure Bacnet (BACnetSC)
- BasicReadAndWrite Example got Nullreference exception when reading Analog input HOT 1
- Is it Possible to Create a BACnet/IP to BACnet/MSTP Router using This Library?
- VS2022 Compile issues with BasicReadWrite Example
- YABE compatibility
- ExceptionSchedule Property - Write
- Notification Class not receiving all notifications in .Net 6.0 Windows/Linux
- Problem in Discovering devices in a network from docker container running in Ubuntu 18 HOT 2
- Decode error when reading PROP_ACTIVE_COV_SUBSCRIPTIONS HOT 2
- False negative address comparison for some BACnet Devices HOT 1
- Error on notification class reception
- Failed to read property PROP_OBJECT_LIST
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 bacnet.