-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
ADS -1 Error #20
Comments
The -1 is emitted at line 104@AmsConnection.h, because AmsConnection::Reserve() detected there is still a request pending on your port.
|
Thanks for the reply, I am did try the option 3. "use a pool of ports and manage access to them" And tested the following test case with my code
But this is not recovering back and it is (code) failing all the time with the -1 error. Could you please let me know the right procedure to the recover. Thanks in advance. |
I can't follow you. I don't think the
There is a very high probability that second will return a I tried to simulate your config mode issue with:
But that looks just fine here:
|
Hi Patrick, Thanks for your work on this excellent library. I'm a contributor to the pyads package which provides a Python wrapper around TcAdsDll.dll on Windows, and this library for Linux/Mac support. We recently had an issue raised (stlehmann/pyads#35) with the same failure mode seen here, which I believe is caused by the use of Kind Regards, |
Hi David, Thanks for your report, that's definitely an interesting reading and everything makes perfect sense. I am just curious to reproduce this issue. Today I tried AdsSyncReadReqEx2() in an endless loop. But the highest rate I could achieve on one thread was 2500 requests per second and I never saw the issue during today. I just want to have some test added to the test suites to have a nice before/after effect when merging the compare_exchange_weak/strong() patch. Best regards, |
Personally I haven't reproduced. I initially misinterpreted the screenshot by @lexe, the 16446 samples are actually happening over a 5 minute period so the sample rate will be lower than what you're achieving. He's running on a Raspberry Pi which will be ARM, so perhaps there's something architecture-specific going on? |
That's it! ARM! |
Wow, that's a tricky one. Glad to be able to help. |
Hi Sven,
Sometimes i am getting an error -1 from the ADS library and i have no idea how to interpret the issue with the error code -1.
I am seeing this particular warning message before getting the error -1 sometimes in a loop when I tried to call the ads function “AdsSyncReadDeviceInfoReqEx” with 2 seconds of delay
Message:
“Warning: Port: 30000 already in use as xxxxx" and that comes from the function “AmsConnection::Reserve” which is called from “AmsConnection::Write”
AmsResponse* AmsConnection::Reserve(uint32_t id, uint16_t port)
{
uint32_t isFree = 0;
if (!queue[port - Router::PORT_BASE].invokeId.compare_exchange_weak(isFree, id)) {
LOG_WARN("Port: " << port << " already in use as " << isFree);
return nullptr;
}
return &queue[port - Router::PORT_BASE];
}
Thanks,
Satheesh
The text was updated successfully, but these errors were encountered: