-
Notifications
You must be signed in to change notification settings - Fork 67
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
SIGBUS in future destructor #229
Comments
Do you have an example program that can reproduce this? |
Not currently. I am trying to produce a minimal example. As of right now I can only reproduce it in situ of some proprietary code. I was hoping you would have an idea on the class of issue this would be so I could have a starting point on making a reduction of the reproducible code. |
In this example is it safe to call |
No. Futures are one use only. So you have to create for each call to package_task a new one. If you have multiple invocatons, you should considre to use a channel |
I know that it won't resolve the future multiple times but is it safe to call it multiple times and have it be ignored? |
It is not allowed to call package_task() multiple times, especially from multiple threads, because the call is not synchronized() |
I don't know if this is the same crash that I ran into but I discovered this while trying to make a minimal example: #include <iostream>
#define STLAB_TASK_SYSTEM 0 // portable
// built with stlab in same directory:
// clang++ -I. -std=c++14 main.cpp
// version 1.4.0 (develop)
#include <stlab/concurrency/default_executor.hpp>
#include <stlab/concurrency/utility.hpp>
#define WANT_SEG_FAULT
int main() {
auto chain = stlab::make_ready_future(stlab::default_executor);
size_t i = 0;
while (true) {
++i;
chain = chain.then([i]{
auto p = stlab::package<void(size_t)>(stlab::default_executor, [](size_t i){
std::cout << i << std::endl;
});
stlab::async(stlab::default_executor, std::bind(p.first, i)).detach();
return p.second;
});
#ifdef WANT_SEG_FAULT
if (i % 10000 == 0) chain = stlab::make_ready_future(stlab::default_executor);
#else
if (i % 1000 == 0) chain = stlab::make_ready_future(stlab::default_executor);
#endif
}
return 0;
} |
Thanks for the example. I can reproduce the problem, on Windows too. |
My very first runs show that there is a stack overflow on Windows with the provided example. I will check later if I get the same results on my Mac. |
Fixed with #PR232 |
Fixed in 1.4.1 |
I am getting a
SIGBUS
when astlab::future
is destructed that I created viastlab::package
and I am not sure why. It does not always happen making me think it is a race condition of some kind.I am on release 4.1.0
Here is a minified stack trace (let me know if you want all the template parameters)
I have been trying to track this down for 4 days now. I have not had any problems like this before with making my own futures. What could possibly cause something like this? I would try to add a minimal code example to reproduce the problem but that would be easier if I had a general idea of where to start.
The text was updated successfully, but these errors were encountered: