Conversation
|
Steve, I don't have a VxWorks environment but when I quickly look at the changes I think your pull request will break support for any VxWorks version < 6.9, for example _Vx_usr_arg_t doesn't seem to be supported in older releases, see ace/Stack_Trace.cpp where there are some ACE macros to workaround the unavailability of that type in older releases. Probably this is the case for any new type/define you use, but hard to say without someone setting up a full build with VxWorks 6.9 and one with an older release, maybe your customer can do that? |
|
Good points, Johnny. I will work on the needed changes. Thanks for the quick review! |
|
The VxWorks 5.5 taskLib documentation describes the API of the older systems, see the following link for that old API description http://www.vxdev.com/docs/vx55man/vxworks/ref/taskLib.html |
…e and change it to a typedef instead of a macro. Generalize use of ACE_VX_USR_ARG_T in place of previously added _Vx_usr_arg_t to restore ability to build on pre-6.9
There was a problem hiding this comment.
According to VxWorks 5.5 the return value in older VxWorks versions is ERROR, not TASK_ID_ERROR, probably also a VX6.9 change see http://www.vxdev.com/docs/vx55man/vxworks/ref/taskLib.html#taskSpawn
There was a problem hiding this comment.
Ok, will change this.
…tem header(s) are not always included and including them here would add unnecessary build time.
Under extreme multi-thread log load tests found that occasionally two threads would lock up on macOS, with one thread reporting EXC_BAD_ACCESS. In our load test environment this happened after about 20 hours of testing. This patch ensures that no log messages are written at the same time as this->log_msg_->msg_ostream()->tell()` Stack trace of log rotation thread getting EXC_BAD_ACCESS on `fwrite()` due to `this->log_msg_->msg_ostream()->tell()`: ``` * thread DOCGroup#1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) * frame #0: 0x00007ff81884b222 libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell + 194 frame DOCGroup#1: 0x00007ff81870833b libsystem_c.dylib`__sfvwrite + 382 frame DOCGroup#2: 0x00007ff818729d0c libsystem_c.dylib`fwrite + 136 frame DOCGroup#3: 0x0000000106a3dabe NetSequencer`std::__1::basic_filebuf<char, std::__1::char_traits<char> >::overflow(this=0x00007f80f3204328, __c=-1) at fstream:823:17 frame DOCGroup#4: 0x0000000106a3cf31 NetSequencer`std::__1::basic_filebuf<char, std::__1::char_traits<char> >::sync(this=0x00007f80f3204328) at fstream:988:17 frame DOCGroup#5: 0x0000000106a3caf8 NetSequencer`std::__1::basic_filebuf<char, std::__1::char_traits<char> >::seekoff(this=0x00007f80f3204328, __off=0, __way=cur, (null)=16) at fstream:928:63 frame DOCGroup#6: 0x0000000107b122c3 NetSequencer`std::__1::basic_streambuf<char, std::__1::char_traits<char> >::pubseekoff(this=0x00007f80f3204328, __off=0, __way=cur, __which=16) at streambuf:159:14 frame DOCGroup#7: 0x0000000107b1109b NetSequencer`std::__1::basic_ostream<char, std::__1::char_traits<char> >::tellp(this=0x00007f80f3204320) at ostream:960:27 frame DOCGroup#8: 0x0000000107b10b97 NetSequencer`ACE_Logging_Strategy::handle_timeout(this=0x00006000012f01b0, (null)=0x00007ff7b94f67d0, (null)=0x0000000000000000) at Logging_Strategy.cpp:432:48 frame DOCGroup#9: 0x0000000107af7ac2 NetSequencer`ACE_Event_Handler_Handle_Timeout_Upcall::timeout(this=0x00006000022c8020, timer_queue=0x00007f80f32041c0, event_handler=0x00006000012f01b0, act=0x0000000000000000, recurring_timer=1, cur_time=0x00007ff7b94f67d0) at Event_Handler_Handle_Timeout_Upcall.cpp:42:22 frame DOCGroup#10: 0x0000000107b38598 NetSequencer`ACE_Timer_Queue_T<ACE_Event_Handler*, ACE_Event_Handler_Handle_Timeout_Upcall, ACE_Recursive_Thread_Mutex, ACE_FPointer_Time_Policy>::upcall(this=0x00007f80f32041c0, info=0x00007ff7b94f6720, cur_time=0x00007ff7b94f67d0) at Timer_Queue_T.inl:36:27 frame DOCGroup#11: 0x0000000107b35702 NetSequencer`ACE_Timer_Queue_T<ACE_Event_Handler*, ACE_Event_Handler_Handle_Timeout_Upcall, ACE_Recursive_Thread_Mutex, ACE_FPointer_Time_Policy>::expire(this=0x00007f80f32041c0, cur_time=0x00007ff7b94f67d0) at Timer_Queue_T.cpp:289:13 frame DOCGroup#12: 0x0000000107b3581f NetSequencer`ACE_Timer_Queue_T<ACE_Event_Handler*, ACE_Event_Handler_Handle_Timeout_Upcall, ACE_Recursive_Thread_Mutex, ACE_FPointer_Time_Policy>::expire(this=0x00007f80f32041c0) at Timer_Queue_T.cpp:258:16 frame DOCGroup#13: 0x0000000107b33a41 NetSequencer`ACE_Select_Reactor_T<ACE_Reactor_Token_T<ACE_Token> >::dispatch_timer_handlers(this=0x00007f80e2808e00, number_of_handlers_dispatched=0x00007ff7b94f6838) at Select_Reactor_T.cpp:1153:56 frame DOCGroup#14: 0x0000000107b33932 NetSequencer`ACE_Select_Reactor_T<ACE_Reactor_Token_T<ACE_Token> >::dispatch(this=0x00007f80e2808e00, active_handle_count=0, dispatch_set=0x00007f80e2808e38) at Select_Reactor_T.cpp:1348:22 frame DOCGroup#15: 0x0000000107b3acb2 NetSequencer`ACE_Select_Reactor_T<ACE_Reactor_Token_T<ACE_Token> >::handle_events_i(this=0x00007f80e2808e00, max_wait_time=0x0000000000000000) at Select_Reactor_T.cpp:1463:15 frame DOCGroup#16: 0x0000000107b306de NetSequencer`ACE_Select_Reactor_T<ACE_Reactor_Token_T<ACE_Token> >::handle_events(this=0x00007f80e2808e00, max_wait_time=0x0000000000000000) at Select_Reactor_T.cpp:1439:16 frame DOCGroup#17: 0x0000000107b2e859 NetSequencer`ACE_Reactor::run_reactor_event_loop(this=0x00006000020f4540, eh=0x0000000000000000)(ACE_Reactor*)) at Reactor.cpp:218:49 frame DOCGroup#18: 0x0000000106ab72c5 NetSequencer`SeqNetServer::go(this=0x00007f80f312da48) at Server.cpp:215:49 ... ``` Another thread that is stuck on `fwrite()` when attempting to log during log rotation: ``` thread DOCGroup#7, name = 'TestMaster' frame #0: 0x00007ff8187fdbd2 libsystem_kernel.dylib`__psynch_mutexwait + 10 frame DOCGroup#1: 0x00007ff818835e7e libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_wait + 76 frame DOCGroup#2: 0x00007ff818833cbb libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_slow + 205 frame DOCGroup#3: 0x00007ff818714ae8 libsystem_c.dylib`flockfile + 31 frame DOCGroup#4: 0x00007ff818729cc6 libsystem_c.dylib`fwrite + 66 frame DOCGroup#5: 0x0000000106a3dabe NetSequencer`std::__1::basic_filebuf<char, std::__1::char_traits<char> >::overflow(this=0x00007f80f3204328, __c=49) at fstream:823:17 frame DOCGroup#6: 0x00007ff8187a27c1 libc++.1.dylib`std::__1::basic_streambuf<char, std::__1::char_traits<char> >::xsputn(char const*, long) + 109 frame DOCGroup#7: 0x0000000106a3f9a6 NetSequencer`std::__1::basic_streambuf<char, std::__1::char_traits<char> >::sputn(this=0x00007f80f3204328, __s="NTC (58424|123145504292864|2022-11-16 05:41:53.094817 HopTracerouteData::getRtts) testId=_42147-1GHN9QEGN_76601, ttl=10, pkt 3403, sendSize=92, recvSize=0, rtt=0, send=1668606099528987, recv=0\n", __n=193) at streambuf:229:14 frame DOCGroup#8: 0x0000000106a3f821 NetSequencer`std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(__s=ostreambuf_iterator<char, std::__1::char_traits<char> > @ 0x000070000c09c190, __ob="NTC (58424|123145504292864|2022-11-16 05:41:53.094817 HopTracerouteData::getRtts) testId=_42147-1GHN9QEGN_76601, ttl=10, pkt 3403, sendSize=92, recvSize=0, rtt=0, send=1668606099528987, recv=0\n", __op="NTC (58424|123145504292864|2022-11-16 05:41:53.094817 HopTracerouteData::getRtts) testId=_42147-1GHN9QEGN_76601, ttl=10, pkt 3403, sendSize=92, recvSize=0, rtt=0, send=1668606099528987, recv=0\n", __oe="", __iob=0x00007f80f3204320, __fl=32 ' ') at locale:1428:26 frame DOCGroup#9: 0x0000000106a3f4fa NetSequencer`std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(__os=0x00007f80f3204320, __str="NTC (58424|123145504292864|2022-11-16 05:41:53.094817 HopTracerouteData::getRtts) testId=_42147-1GHN9QEGN_76601, ttl=10, pkt 3403, sendSize=92, recvSize=0, rtt=0, send=1668606099528987, recv=0\n", __len=193) at ostream:718:17 frame DOCGroup#10: 0x0000000106abfaf9 NetSequencer`std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(__os=0x00007f80f3204320, __str="NTC (58424|123145504292864|2022-11-16 05:41:53.094817 HopTracerouteData::getRtts) testId=_42147-1GHN9QEGN_76601, ttl=10, pkt 3403, sendSize=92, recvSize=0, rtt=0, send=1668606099528987, recv=0\n") at ostream:857:12 frame DOCGroup#11: 0x0000000107b0eb7a NetSequencer`ACE_Log_Record::print(this=0x000070000c09cf20, host_name=0x0000000000000000, verbose_flag=5, s=0x00007f80f3204320) at Log_Record.cpp:427:13 frame DOCGroup#12: 0x0000000107b0b81d NetSequencer`ACE_Log_Msg::log(this=0x00007f810400c000, log_record=0x000070000c09cf20, suppress_stderr=0) at Log_Msg.cpp:2932:20 frame DOCGroup#13: 0x0000000107b0aed9 NetSequencer`ACE_Log_Msg::log(this=0x00007f810400c000, format_str="", log_priority=LM_NOTICE, argp=0x000070000c09e1b0, category=0x0000000000000000) at Log_Msg.cpp:2200:22 frame DOCGroup#14: 0x000000010750e196 NetSequencer`APN::LogUtil::log(logPriority=LM_NOTICE, formatStr="NTC%I (%P|%t|%D HopTracerouteData::getRtts) testId=%s, ttl=%u, pkt %u, sendSize=%u, recvSize=%u, rtt=%u, send=%Q, recv=%Q\n") at macros.cpp:44:19 ... ```
This is a set of changes I am assisting a customer with. I do not have a build environment to test with, but the customer does and they've approved the changes for VxWorks.