Skip to content
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

Operation not permitted on try_consume_message async #474

Open
candaj2 opened this issue Jan 20, 2024 · 3 comments
Open

Operation not permitted on try_consume_message async #474

candaj2 opened this issue Jan 20, 2024 · 3 comments
Milestone

Comments

@candaj2
Copy link

candaj2 commented Jan 20, 2024

Hello,
I'm having an issue using the try_consume_message(const_message_ptr *msg) method.
When executing it's always throwing a "std::system_error" exception. You can find following the stacktrace:

` terminate called after throwing an instance of 'std::system_error'
  what():  Operation not permitted
--Type <RET> for more, q to quit, c to continue without paging--

Thread 5 "server" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffebfff700 (LWP 188904)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff6fec537 in __GI_abort () at abort.c:79
#2  0x00007ffff72757ec in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff7280966 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff72809d1 in std::terminate() () from /lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff7280c65 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff7278458 in std::__throw_system_error(int) () from /lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00005555561e38d8 in std::unique_lock<std::mutex>::lock (this=0x7fffebffe5c0) at /usr/include/c++/10/bits/unique_lock.h:133
#8  0x00005555561e2831 in std::unique_lock<std::mutex>::unique_lock (this=0x7fffebffe5c0, __m=...) at /usr/include/c++/10/bits/unique_lock.h:68
#9  0x00007ffff7f5a365 in mqtt::thread_queue<std::shared_ptr<mqtt::message const>, std::deque<std::shared_ptr<mqtt::message const>, std::allocator<std::shared_ptr<mqtt::message const> > > >::try_get(std::shared_ptr<mqtt::message const>*) () from /usr/local/lib/libpaho-mqttpp3.so.1
#10 0x00007ffff7f588a6 in mqtt::async_client::try_consume_message(std::shared_ptr<mqtt::message const>*) () 
`

Is there any known issue about that ? I'm in v1.3.2 and can share a code without the boilerplate if needed

@candaj2
Copy link
Author

candaj2 commented Feb 24, 2024

Hello,
Can someone have any idea about that

@fpagliughi
Copy link
Contributor

Yes, please share a small code sample with the problem.

@fpagliughi fpagliughi added this to the v1.4.1 milestone Jul 8, 2024
@fpagliughi
Copy link
Contributor

fpagliughi commented Jul 9, 2024

I can't reproduce this in the latest development branches ('v1.4.x' and 'develop').

I modified the read loop in the async_consumer_v5 sample app as follows:

while (true) {
    mqtt::const_message_ptr msg;
			
    if (!cli.try_consume_message(&msg)) {
        this_thread::sleep_for(100ms);
        continue;
    }
			
    if (!msg)
        break;

    cout << msg->get_topic() << ": " << msg->to_string() << endl;
}

Works for me.

@fpagliughi fpagliughi modified the milestones: v1.4.1, v1.5 Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants