Я все еще пытаюсь отлаживать сбой, подробно описанный в аварии в std :: make_exception_ptr на aix
имела мысль, что ему есть чем заняться с использованием std :: exception_ptr , поскольку я рефактировал какой -то код, чтобы использовать его до того, как сбой начал произойти
, мне удалось воспроизвести аналогичный сбой, используя следующий код, но только при использовании Malloctype = Debug mallocdebug = postfree_checking
#include
#include
#include
#include
#include
std::future GetExceptionFromDeadThread()
{
return std::async(std::launch::async, []() {
try
{
throw std::invalid_argument("Some string long enough to allocate on the heap? ");
}
catch (...)
{
return std::current_exception();
}
});
}
int main()
{
try
{
constexpr size_t numThreads(100);
std::vector futures;
while (true)
{
for (size_t i = 0; i < numThreads; ++i)
{
futures.push_back(GetExceptionFromDeadThread());
}
while (!futures.empty())
{
auto& future(futures.back());
future.wait();
try
{
std::rethrow_exception(future.get());
}
catch (std::invalid_argument&)
{
std::fputs(".", stdout);
}
catch (...)
{
std::fprintf(stderr, "'std::rethrow_exception(future.get())' threw unexpected exception");
abort();
}
futures.pop_back();
}
}
}
catch (...)
{
std::fprintf(stderr, "Caught unexpected exception");
abort();
}
}
< /code>
Я собираю программу, используя команду xlclang ++ -std = c ++ 11 -d_reentrant -qfullpath -qmaxmem = -1 -q32 -qroconst -dndebug -o2 -g test8.cpp
bash-5.2$ xlclang++ --version
IBM XL C/C++ for AIX, V16.1.0 (5725-C72, 5765-J12)
Version: 16.01.0000.0010
bash-5.2$ MALLOCTYPE=debug MALLOCDEBUG=postfree_checking ./a.out
.Segmentation fault (core dumped)
bash-5.2$ dbx ./a.out core
Type 'help' for help.
[using memory image in core]
reading symbolic information ...
Segmentation fault in __cxa_end_catch at 0xd0ead49c ($t1)
0xd0ead49c (__cxa_end_catch+0x1fc) 801e003c lwz r0,0x3c(r30)
(dbx) where
__cxa_end_catch() at 0xd0ead49c
main(), line 46 in "test8.cpp"
(dbx)
строка 46 - это std :: fputs (".", stdout); line
Кто -нибудь видит любой вид ub /ошибки в моем коде, которые «оправдывают» этот сбой?
...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................Segmentation fault (core dumped)
You have new mail in /usr/spool/mail/bamboo
bash-5.2$ dbx ./a.out core
Type 'help' for help.
[using memory image in core]
reading symbolic information ...
warning: Unable to access address 0x2ff21d50 from core
Segmentation fault in extend_brk at 0xd01105c4 ($t1)
0xd01105c4 (extend_brk+0x2c4) 90040004 stw r0,0x4(r4)
(dbx) where
extend_brk(internal error: assertion failed at line 3915 in file frame.c
??, internal error: assertion failed at line 3915 in file frame.c
??, internal error: assertion failed at line 3915 in file frame.c
??) at 0xd01105c4
(dbx)
< /code>
Какого черта? Как у него заканчивается память? (и тьфу @ как Buggy dbx is)
edit 2: снова после выполнения экспорта ldr_cntrl = maxdata = 0x80000000 ( Делал это раньше при тестировании с фактической программой сбоя), не видел еще одного аварии, но очень странно, что использование памяти вообще будет расти? (... std :: async потоки выходят слишком медленно?) отладчик < /p>
stopped in _event_sleep at 0xd0573254 ($t1)
0xd0573254 (_event_sleep+0x4f4) 80410014 lwz r2,0x14(r1)
(dbx) where
_event_sleep(??, ??, ??, ??, ??, ??) at 0xd0573254
_event_wait(??, ??) at 0xd0573f3c
_cond_wait_local(??, ??, ??) at 0xd05835dc
_cond_wait(??, ??, ??) at 0xd0583ef4
pthread_cond_wait(??, ??) at 0xd058494c
condition_variable.std::__1::condition_variable::wait(std::__1::unique_lock&)(??, ??) at 0xd09f2eac
future.std::__1::promise::set_exception_at_thread_exit(std::exception_ptr)._ZNSt3__117__assoc_sub_state10__sub_waitERNS_11unique_lockINS_5mutexEEE@AF111_20(??, ??) at 0xd09f99a8
std::__1::__assoc_sub_state::wait()(??) at 0xd09f7a28
std::__1::__async_assoc_state::__on_zero_shared()(this = 0x42242282), line 992 in "future"
test8.std::__1::future std::__1::__make_async_assoc_state(std::__1::__async_func&&)(__f = @0x30013418), line 3440 in "memory"
unnamed block in std::__1::future std::__1::async(std::__1::launch, GetExceptionFromDeadThread()::$_0&&)(__policy = async, __f = &(...)), line 2220 in "type_traits"
std::__1::future std::__1::async(std::__1::launch, GetExceptionFromDeadThread()::$_0&&)(__policy = async, __f = &(...)), line 2220 in "type_traits"
unnamed block in main(), line 9 in "test8.cpp"
unnamed block in main(), line 9 in "test8.cpp"
unnamed block in main(), line 9 in "test8.cpp"
main(), line 9 in "test8.cpp"
(dbx) thread
thread state-k wchan state-u k-tid mode held scope function
>$t1 run blocked 33360255 k no sys _event_sleep
$t2148206 terminated 36507643 no sys
$t7220275 terminated 123211641 no sys
$t10994266 terminated 15139439 no sys
(dbx) q
, к сожалению, отказаться от DBX также убил процесс (не уверен, есть ли способ сначала отключиться от процесса), поэтому я не мог внимательно смотреть на потоки, но данный Тот факт, что они все говорят «завершены», кроме основного потока, кажется, что это был тупик? > (Версия AIX Top ), похоже, что у моей программы тестирования есть какая -то утечка? Я видел, как он перешел от ~ 500 до ~ 900 млн. ПГСП, и когда я смотрел на «подвешенного», он использовал ровно 2,00 г, так что кажется, что он висит, когда у него заканчивается память? p>
edit 5: I воспроизводил Hang, а топас показал 2.00G для pgsp , подтвердил, что другие потоки были на самом деле мертвые (см. Что делает '. () At 0xdeadbeef' среднее в (основной файл) Stacktrace, сгенерированной DBX на AIX?)
stopped in _event_sleep at 0xd0573254 ($t1)
0xd0573254 (_event_sleep+0x4f4) 80410014 lwz r2,0x14(r1)
(dbx) where
_event_sleep(??, ??, ??, ??, ??, ??) at 0xd0573254
_event_wait(??, ??) at 0xd0573f3c
_cond_wait_local(??, ??, ??) at 0xd05835dc
_cond_wait(??, ??, ??) at 0xd0583ef4
pthread_cond_wait(??, ??) at 0xd058494c
condition_variable.std::__1::condition_variable::wait(std::__1::unique_lock&)(??, ??) at 0xd09f2eac
future.std::__1::promise::set_exception_at_thread_exit(std::exception_ptr)._ZNSt3__117__assoc_sub_state10__sub_waitERNS_11unique_lockINS_5mutexEEE@AF111_20(??, ??) at 0xd09f99a8
std::__1::__assoc_sub_state::wait()(??) at 0xd09f7a28
std::__1::__async_assoc_state::__on_zero_shared()(this = 0x42242282), line 992 in "future"
test8.std::__1::future std::__1::__make_async_assoc_state(std::__1::__async_func&&)(__f = @0x300122e8), line 3440 in "memory"
unnamed block in std::__1::future std::__1::async(std::__1::launch, GetExceptionFromDeadThread()::$_0&&)(__policy = async, __f = &(...)), line 2220 in "type_traits"
std::__1::future std::__1::async(std::__1::launch, GetExceptionFromDeadThread()::$_0&&)(__policy = async, __f = &(...)), line 2220 in "type_traits"
unnamed block in main(), line 9 in "test8.cpp"
unnamed block in main(), line 9 in "test8.cpp"
unnamed block in main(), line 9 in "test8.cpp"
main(), line 9 in "test8.cpp"
(dbx) thread
thread state-k wchan state-u k-tid mode held scope function
>$t1 run blocked 72682831 k no sys _event_sleep
$t551804 terminated 117246667 no sys
$t971604 terminated 35326155 no sys
$t4654003 terminated 66456569 no sys
$t8224903 terminated 113575163 no sys
$t10640704 terminated 66914049 no sys
$t10991453 terminated 117574363 no sys
(dbx) thread current 551804
(dbx) where
.() at 0xdeadbeef
(dbx) thread current 971604
(dbx) where
.() at 0xdeadbeef
(dbx) thread current 4654003
(dbx) where
.() at 0xdeadbeef
(dbx) thread current 8224903
(dbx) where
.() at 0xdeadbeef
(dbx) thread current 10640704
(dbx) where
.() at 0xdeadbeef
(dbx) thread current 10991453
(dbx) where
.() at 0xdeadbeef
(dbx)
Не уверен, куда идти отсюда, если в моем коде нет какого -то UB, кажется, что я обнаружил некоторые ошибки (ы) компилятора/инструментов?
Редактировать 6: Я попытался удалить использование std :: exception_ptr (смотрите, почему эта простая программа, которая использует STD :: Async Crashing?), И я все еще получаю Повесить: < /p>
stopped in _event_sleep at 0xd0573254 ($t1)
0xd0573254 (_event_sleep+0x4f4) 80410014 lwz r2,0x14(r1)
(dbx) where
_event_sleep(??, ??, ??, ??, ??, ??) at 0xd0573254
_event_wait(??, ??) at 0xd0573f3c
_cond_wait_local(??, ??, ??) at 0xd05835dc
_cond_wait(??, ??, ??) at 0xd0583ef4
pthread_cond_wait(??, ??) at 0xd058494c
condition_variable.std::__1::condition_variable::wait(std::__1::unique_lock&)(??, ??) at 0xd09f2eac
future.std::__1::promise::set_exception_at_thread_exit(std::exception_ptr)._ZNSt3__117__assoc_sub_state10__sub_waitERNS_11unique_lockINS_5mutexEEE@AF111_20(??, ??) at 0xd09f99a8
std::__1::__assoc_sub_state::wait()(??) at 0xd09f7a28
std::__1::__async_assoc_state::__on_zero_shared()(this = (nil)), line 992 in "future"
test9.std::__1::future std::__1::__make_async_assoc_state(std::__1::__async_func&&)(__f = @0x2ff225e0), line 3440 in "memory"
unnamed block in std::__1::future std::__1::async(std::__1::launch, GetExceptionFromDeadThread()::$_0&&)(__policy = async, __f = &(...)), line 2220 in "type_traits"
std::__1::future std::__1::async(std::__1::launch, GetExceptionFromDeadThread()::$_0&&)(__policy = async, __f = &(...)), line 2220 in "type_traits"
unnamed block in main(), line 9 in "test9.cpp"
unnamed block in main(), line 9 in "test9.cpp"
unnamed block in main(), line 9 in "test9.cpp"
main(), line 9 in "test9.cpp"
(dbx) thread
thread state-k wchan state-u k-tid mode held scope function
>$t1 run blocked 114165241 k no sys _event_sleep
$t243103 terminated 4853817 no sys
$t1366707 terminated 128123751 no sys
(dbx)
Подробнее здесь: https://stackoverflow.com/questions/794 ... ng-xlclang
Сбой в __cxa_end_catch на AIX с использованием xlclang ++ ⇐ C++
Программы на C++. Форум разработчиков
-
Anonymous
1739998569
Anonymous
Я все еще пытаюсь отлаживать сбой, подробно описанный в аварии в std :: make_exception_ptr на aix
имела мысль, что ему есть чем заняться с использованием std :: exception_ptr , поскольку я рефактировал какой -то код, чтобы использовать его до того, как сбой начал произойти
, мне удалось воспроизвести аналогичный сбой, используя следующий код, но только при использовании Malloctype = Debug mallocdebug = postfree_checking
#include
#include
#include
#include
#include
std::future GetExceptionFromDeadThread()
{
return std::async(std::launch::async, []() {
try
{
throw std::invalid_argument("Some string long enough to allocate on the heap? ");
}
catch (...)
{
return std::current_exception();
}
});
}
int main()
{
try
{
constexpr size_t numThreads(100);
std::vector futures;
while (true)
{
for (size_t i = 0; i < numThreads; ++i)
{
futures.push_back(GetExceptionFromDeadThread());
}
while (!futures.empty())
{
auto& future(futures.back());
future.wait();
try
{
std::rethrow_exception(future.get());
}
catch (std::invalid_argument&)
{
std::fputs(".", stdout);
}
catch (...)
{
std::fprintf(stderr, "'std::rethrow_exception(future.get())' threw unexpected exception");
abort();
}
futures.pop_back();
}
}
}
catch (...)
{
std::fprintf(stderr, "Caught unexpected exception");
abort();
}
}
< /code>
Я собираю программу, используя команду xlclang ++ -std = c ++ 11 -d_reentrant -qfullpath -qmaxmem = -1 -q32 -qroconst -dndebug -o2 -g test8.cpp
bash-5.2$ xlclang++ --version
IBM XL C/C++ for AIX, V16.1.0 (5725-C72, 5765-J12)
Version: 16.01.0000.0010
bash-5.2$ MALLOCTYPE=debug MALLOCDEBUG=postfree_checking ./a.out
.Segmentation fault (core dumped)
bash-5.2$ dbx ./a.out core
Type 'help' for help.
[using memory image in core]
reading symbolic information ...
Segmentation fault in __cxa_end_catch at 0xd0ead49c ($t1)
0xd0ead49c (__cxa_end_catch+0x1fc) 801e003c lwz r0,0x3c(r30)
(dbx) where
__cxa_end_catch() at 0xd0ead49c
main(), line 46 in "test8.cpp"
(dbx)
строка 46 - это std :: fputs (".", stdout); line
Кто -нибудь видит любой вид ub /ошибки в моем коде, которые «оправдывают» этот сбой?
...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................Segmentation fault (core dumped)
You have new mail in /usr/spool/mail/bamboo
bash-5.2$ dbx ./a.out core
Type 'help' for help.
[using memory image in core]
reading symbolic information ...
warning: Unable to access address 0x2ff21d50 from core
Segmentation fault in extend_brk at 0xd01105c4 ($t1)
0xd01105c4 (extend_brk+0x2c4) 90040004 stw r0,0x4(r4)
(dbx) where
extend_brk(internal error: assertion failed at line 3915 in file frame.c
??, internal error: assertion failed at line 3915 in file frame.c
??, internal error: assertion failed at line 3915 in file frame.c
??) at 0xd01105c4
(dbx)
< /code>
Какого черта? Как у него заканчивается память? (и тьфу @ как Buggy dbx is)
[b] edit 2: [/b] снова после выполнения экспорта ldr_cntrl = maxdata = 0x80000000 ( Делал это раньше при тестировании с фактической программой сбоя), не видел еще одного аварии, но очень странно, что использование памяти вообще будет расти? (... std :: async потоки выходят слишком медленно?) отладчик < /p>
stopped in _event_sleep at 0xd0573254 ($t1)
0xd0573254 (_event_sleep+0x4f4) 80410014 lwz r2,0x14(r1)
(dbx) where
_event_sleep(??, ??, ??, ??, ??, ??) at 0xd0573254
_event_wait(??, ??) at 0xd0573f3c
_cond_wait_local(??, ??, ??) at 0xd05835dc
_cond_wait(??, ??, ??) at 0xd0583ef4
pthread_cond_wait(??, ??) at 0xd058494c
condition_variable.std::__1::condition_variable::wait(std::__1::unique_lock&)(??, ??) at 0xd09f2eac
future.std::__1::promise::set_exception_at_thread_exit(std::exception_ptr)._ZNSt3__117__assoc_sub_state10__sub_waitERNS_11unique_lockINS_5mutexEEE@AF111_20(??, ??) at 0xd09f99a8
std::__1::__assoc_sub_state::wait()(??) at 0xd09f7a28
std::__1::__async_assoc_state::__on_zero_shared()(this = 0x42242282), line 992 in "future"
test8.std::__1::future std::__1::__make_async_assoc_state(std::__1::__async_func&&)(__f = @0x30013418), line 3440 in "memory"
unnamed block in std::__1::future std::__1::async(std::__1::launch, GetExceptionFromDeadThread()::$_0&&)(__policy = async, __f = &(...)), line 2220 in "type_traits"
std::__1::future std::__1::async(std::__1::launch, GetExceptionFromDeadThread()::$_0&&)(__policy = async, __f = &(...)), line 2220 in "type_traits"
unnamed block in main(), line 9 in "test8.cpp"
unnamed block in main(), line 9 in "test8.cpp"
unnamed block in main(), line 9 in "test8.cpp"
main(), line 9 in "test8.cpp"
(dbx) thread
thread state-k wchan state-u k-tid mode held scope function
>$t1 run blocked 33360255 k no sys _event_sleep
$t2148206 terminated 36507643 no sys
$t7220275 terminated 123211641 no sys
$t10994266 terminated 15139439 no sys
(dbx) q
, к сожалению, отказаться от DBX также убил процесс (не уверен, есть ли способ сначала отключиться от процесса), поэтому я не мог внимательно смотреть на потоки, но данный Тот факт, что они все говорят «завершены», кроме основного потока, кажется, что это был тупик? > (Версия AIX Top ), похоже, что у моей программы тестирования есть какая -то утечка? Я видел, как он перешел от ~ 500 до ~ 900 млн. ПГСП, и когда я смотрел на «подвешенного», он использовал ровно 2,00 г, так что кажется, что он висит, когда у него заканчивается память? p>
[b] edit 5: [/b] I воспроизводил Hang, а топас показал 2.00G для pgsp , подтвердил, что другие потоки были на самом деле мертвые (см. Что делает '. () At 0xdeadbeef' среднее в (основной файл) Stacktrace, сгенерированной DBX на AIX?)
stopped in _event_sleep at 0xd0573254 ($t1)
0xd0573254 (_event_sleep+0x4f4) 80410014 lwz r2,0x14(r1)
(dbx) where
_event_sleep(??, ??, ??, ??, ??, ??) at 0xd0573254
_event_wait(??, ??) at 0xd0573f3c
_cond_wait_local(??, ??, ??) at 0xd05835dc
_cond_wait(??, ??, ??) at 0xd0583ef4
pthread_cond_wait(??, ??) at 0xd058494c
condition_variable.std::__1::condition_variable::wait(std::__1::unique_lock&)(??, ??) at 0xd09f2eac
future.std::__1::promise::set_exception_at_thread_exit(std::exception_ptr)._ZNSt3__117__assoc_sub_state10__sub_waitERNS_11unique_lockINS_5mutexEEE@AF111_20(??, ??) at 0xd09f99a8
std::__1::__assoc_sub_state::wait()(??) at 0xd09f7a28
std::__1::__async_assoc_state::__on_zero_shared()(this = 0x42242282), line 992 in "future"
test8.std::__1::future std::__1::__make_async_assoc_state(std::__1::__async_func&&)(__f = @0x300122e8), line 3440 in "memory"
unnamed block in std::__1::future std::__1::async(std::__1::launch, GetExceptionFromDeadThread()::$_0&&)(__policy = async, __f = &(...)), line 2220 in "type_traits"
std::__1::future std::__1::async(std::__1::launch, GetExceptionFromDeadThread()::$_0&&)(__policy = async, __f = &(...)), line 2220 in "type_traits"
unnamed block in main(), line 9 in "test8.cpp"
unnamed block in main(), line 9 in "test8.cpp"
unnamed block in main(), line 9 in "test8.cpp"
main(), line 9 in "test8.cpp"
(dbx) thread
thread state-k wchan state-u k-tid mode held scope function
>$t1 run blocked 72682831 k no sys _event_sleep
$t551804 terminated 117246667 no sys
$t971604 terminated 35326155 no sys
$t4654003 terminated 66456569 no sys
$t8224903 terminated 113575163 no sys
$t10640704 terminated 66914049 no sys
$t10991453 terminated 117574363 no sys
(dbx) thread current 551804
(dbx) where
.() at 0xdeadbeef
(dbx) thread current 971604
(dbx) where
.() at 0xdeadbeef
(dbx) thread current 4654003
(dbx) where
.() at 0xdeadbeef
(dbx) thread current 8224903
(dbx) where
.() at 0xdeadbeef
(dbx) thread current 10640704
(dbx) where
.() at 0xdeadbeef
(dbx) thread current 10991453
(dbx) where
.() at 0xdeadbeef
(dbx)
Не уверен, куда идти отсюда, если в моем коде нет какого -то UB, кажется, что я обнаружил некоторые ошибки (ы) компилятора/инструментов?
[b] Редактировать 6: [/b] Я попытался удалить использование std :: exception_ptr (смотрите, почему эта простая программа, которая использует STD :: Async Crashing?), И я все еще получаю Повесить: < /p>
stopped in _event_sleep at 0xd0573254 ($t1)
0xd0573254 (_event_sleep+0x4f4) 80410014 lwz r2,0x14(r1)
(dbx) where
_event_sleep(??, ??, ??, ??, ??, ??) at 0xd0573254
_event_wait(??, ??) at 0xd0573f3c
_cond_wait_local(??, ??, ??) at 0xd05835dc
_cond_wait(??, ??, ??) at 0xd0583ef4
pthread_cond_wait(??, ??) at 0xd058494c
condition_variable.std::__1::condition_variable::wait(std::__1::unique_lock&)(??, ??) at 0xd09f2eac
future.std::__1::promise::set_exception_at_thread_exit(std::exception_ptr)._ZNSt3__117__assoc_sub_state10__sub_waitERNS_11unique_lockINS_5mutexEEE@AF111_20(??, ??) at 0xd09f99a8
std::__1::__assoc_sub_state::wait()(??) at 0xd09f7a28
std::__1::__async_assoc_state::__on_zero_shared()(this = (nil)), line 992 in "future"
test9.std::__1::future std::__1::__make_async_assoc_state(std::__1::__async_func&&)(__f = @0x2ff225e0), line 3440 in "memory"
unnamed block in std::__1::future std::__1::async(std::__1::launch, GetExceptionFromDeadThread()::$_0&&)(__policy = async, __f = &(...)), line 2220 in "type_traits"
std::__1::future std::__1::async(std::__1::launch, GetExceptionFromDeadThread()::$_0&&)(__policy = async, __f = &(...)), line 2220 in "type_traits"
unnamed block in main(), line 9 in "test9.cpp"
unnamed block in main(), line 9 in "test9.cpp"
unnamed block in main(), line 9 in "test9.cpp"
main(), line 9 in "test9.cpp"
(dbx) thread
thread state-k wchan state-u k-tid mode held scope function
>$t1 run blocked 114165241 k no sys _event_sleep
$t243103 terminated 4853817 no sys
$t1366707 terminated 128123751 no sys
(dbx)
Подробнее здесь: [url]https://stackoverflow.com/questions/79449969/crash-in-cxa-end-catch-on-aix-using-xlclang[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия