-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem: ZMQ_SOCKET_LIMIT and ZMQ_THREAD_PRIORITY have the same value #3362
Comments
-1 is the default, so it can't really be a coincidence. But I'm not really sure how it could possibly fail to set the parameter, and not return an error... the code is pretty straight forward: 22c3ecc |
@bluca, it's not really returning It's also not failing to set the priority. It fails when it retrieves it with |
How are you getting 65,535? My point is that the only possible values are 1, which is the setting in the test, and -1, which is the default, it can't really be anything else |
Given this code fragment modified in int rc;
...
rc = zmq_ctx_set (ctx_, ZMQ_THREAD_PRIORITY, 10);
rc = zmq_ctx_get (ctx_, ZMQ_THREAD_PRIORITY);
printf("%i \n", rc); no matter which value I put instead of I however understand what you mean @bluca. The int rc;
...
rc = zmq_ctx_set (ctx_, ZMQ_THREAD_PRIORITY, -10);
printf("%i \n", rc); the value returned is I don't know why Do you have any clue what could possibly be changed in the system to make this test pass? I have another Arch GNU/Linux system (fully upgraded) where the test passes. |
I have no idea, sorry. I have never seen that anywhere, on any platform. I honestly think there is something quite wrong with that system... as you can see the code is as simple and straightforward as it can be. |
Maybe there is some strange ABI difference between libzmq and the test, so the calling conventions mismatch. Can you attach the build log showing the compiler options of both the libzmq and test builds? |
After further tests, I found that in the system where things were "working", the nice level could not be changed. Therefore, the test was being skipped due to:
in line 115 of After allowing any program to raise the nice level to any value, So, to reproduce the error you just need to give processes the right to elevate the niceness of a process to any value. In
|
...oh boy. Spot the error...
https://github.com/zeromq/libzmq/blob/master/include/zmq.h#L214 |
That used to work because ZMQ_SOCKET_LIMIT was get-only and ZMQ_THREAD_PRIORITY was set-only. Then I added the getter for ZMQ_THREAD_PRIORITY, which actually returns ZMQ_SOCKET_LIMIT which is... 65535. Bingo. |
We can either un-document and remove the test for the getter of ZMQ_THREAD_PRIORITY, or change its value but keep the setter working with the older value for backward-compatibility. |
Bingo! |
Would there be too many problems if |
It's the second solution I proposed and technically it's an ABI breakage |
Assuming that library users directly access |
With a backward compatible layer in the library as I mentioned it's fine for the setter, but the getter will never work without a rebuild |
Actually the value can't be changed - it would be backward-compatible but not forward-compatible. Applications linked against the new version wouldn't work with the old version. I'll un-document the getter and remove this test. |
How to check or verify zmq io-threads priority, if we can't get ZMQ_THREAD_PRIORITY ? |
If it wasn't changed, then it's the default as documented |
I try to modify zmq io threads scheduing policy to SCHED_RR and priproty to 99,run as root,but all ZMQbg/n threads PRI value always 20 |
ensure you are setting those before creating any socket |
Issue description
test_ctx_options
fails and I'm unable to identify the reasons why.In particular, the part of the test that fails, located in
test_ctx_options.cpp
, is the second assert in:I manually checked and the call to
zmq_ctx_set ( ctx_, ZMQ_THREAD_PRIORITY, 1)
is successful, returning1
. However, the call torc = zmq_ctx_get (ctx_, ZMQ_THREAD_PRIORITY)
returns the value65,535
. In the beginning I thought this value was a-1
, indicating that the call tozmq_ctx_get
failed.After investigating the returned value, it seems that it is not a
-1
aszmq_ctx_get
returns anint
and not ashort int
.How could I debug this problem further? It may seem that the problem is in the way that priority is acquired?
Environment
The command
ulimit -a
shows:What's the actual result?
Command line output of the test:
Contents of the test log:
The text was updated successfully, but these errors were encountered: