bugGNU Octave - Bugs: bug #53774, instrument-control creates massive...

 
 

bug #53774: instrument-control creates massive numbers of threads when reading

Submitter:  None
Submitted:  Sat 28 Apr 2018 02:41:40 AM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  lostbard
Originator Name:  Witold Baryluk Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 4.4.0
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 14 May 2018 01:36:06 PM UTC, comment #5: 

Closing with the release of 0.3.1

John Donoghue <lostbard>
Group Member
Wed 02 May 2018 05:00:13 PM UTC, comment #4: 

Ive pushed up some changes to the repo so that when a new version is released, tis will be fixed.

https://sourceforge.net/p/octave/instrument-control/ci/2ce2d0ec3491233ff23b57c42e41aa410b1f67f0/


John Donoghue <lostbard>
Group Member
Sun 29 Apr 2018 12:18:37 PM UTC, comment #3: 

All the created threads are released when octave quits, rather than when going away when the signals are restored.

John Donoghue <lostbard>
Group Member
Sun 29 Apr 2018 12:15:29 PM UTC, comment #2: 

ok running on my computer under gdb, when running instrument-control with the following:


more off

a = serial('/dev/ttyS0', 9600, 1)

while (1)
  [x,c] = srl_read(a, 1000)
end


When running in octave 4.2.1, it does not create new threads.

In octave 4.9.92, running the same code, gdb is showing a new thread created each time srl_read is called.

The current serial code sets a a signal handler before calling the os read of the serial port, and then restores it, so updates on octaves set signal handler must be doing something.

John Donoghue <lostbard>
Group Member
Sat 28 Apr 2018 10:40:46 AM UTC, comment #1: 

A few questions:

Which version of instrument-control,

what hg tag was the dev version of octave used.

Was instrument control cinstalled/compiled for that specic version of octave, or was installed using prior versions of octave.

What kind of data/how much data was being sent vs how much was the sript trying to read.

John Donoghue <lostbard>
Group Member
Sat 28 Apr 2018 02:41:40 AM UTC, original submission:  

It creates ~15000 threads then crashed after reaching some limit:


in gdb:

[New Thread 0x7fef698ce700 (LWP 18383)]
[New Thread 0x7fef690cd700 (LWP 18384)]
[New Thread 0x7fef688cc700 (LWP 18385)]
[New Thread 0x7fef680cb700 (LWP 18386)]
[New Thread 0x7fef678ca700 (LWP 18387)]
[New Thread 0x7fef670c9700 (LWP 18388)]
[New Thread 0x7fef668c8700 (LWP 18389)]
[New Thread 0x7fef660c7700 (LWP 18390)]
[New Thread 0x7fef658c6700 (LWP 18391)]
[New Thread 0x7fef650c5700 (LWP 18392)]
[New Thread 0x7fef648c4700 (LWP 18393)]
[New Thread 0x7fef640c3700 (LWP 18394)]
[New Thread 0x7fef638c2700 (LWP 18395)]
[New Thread 0x7fef630c1700 (LWP 18396)]
[New Thread 0x7fef628c0700 (LWP 18397)]
[New Thread 0x7fef620bf700 (LWP 18398)]
[New Thread 0x7fef618be700 (LWP 18399)]
[New Thread 0x7fef610bd700 (LWP 18400)]
[New Thread 0x7fef608bc700 (LWP 18401)]
[New Thread 0x7fef600bb700 (LWP 18402)]
[New Thread 0x7fef5f8ba700 (LWP 18403)]
[New Thread 0x7fef5f0b9700 (LWP 18404)]
[New Thread 0x7fef5e8b8700 (LWP 18405)]
[New Thread 0x7fef5e0b7700 (LWP 18406)]
[New Thread 0x7fef5d8b6700 (LWP 18407)]
[New Thread 0x7fef5d0b5700 (LWP 18408)]
[New Thread 0x7fef5c8b4700 (LWP 18409)]



Thread 5 "QThread" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffcbfff700 (LWP 8139)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: Nie ma takiego pliku ani katalogu.
(gdb)
(gdb)
(gdb) bt
#0  0x00007ffff3fd1e7b in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff3fd3231 in __GI_abort () at abort.c:79
#2  0x00007ffff60fefc6 in octave_create_interrupt_watcher_thread ()
    at /usr/lib/x86_64-linux-gnu/liboctave.so.5
#3  0x00007fffca1cbcbf in instrument_control::install_signal_handlers() () at ../octave-wrappers.h:22
#4  0x00007fffca1cbcbf in Fsrl_read(octave_value_list const&, int) (args=..., nargout=<optimized out>)
    at srl_read.cc:103
#5  0x00007ffff6cb57d5 in octave_builtin::call(octave::tree_evaluator&, int, octave_value_list const&) () at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#6  0x00007ffff6e76fa0 in octave::tree_evaluator::visit_index_expression(octave::tree_index_expression&) () at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#7  0x00007ffff6e78d70 in octave::tree_evaluator::visit_multi_assignment(octave::tree_multi_assignment&) () at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#8  0x00007ffff6d00554 in octave::tree_evaluator::evaluate(octave::tree_expression*, int) ()
    at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#9  0x00007ffff6e74f38 in octave::tree_evaluator::visit_statement(octave::tree_statement&) ()
    at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#10 0x00007ffff6e6b490 in octave::tree_evaluator::visit_statement_list(octave::tree_statement_list&) ()
    at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#11 0x00007ffff6e756a4 in octave::tree_evaluator::visit_while_command(octave::tree_while_command&) ()
    at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#12 0x00007ffff6e74ee1 in octave::tree_evaluator::visit_statement(octave::tree_statement&) ()
    at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#13 0x00007ffff6e6b490 in octave::tree_evaluator::visit_statement_list(octave::tree_statement_list&) ()
---Type <return> to continue, or q <return> to quit---
    at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#14 0x00007ffff6daf707 in octave_user_script::call(octave::tree_evaluator&, int, octave_value_list const&) () at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#15 0x00007ffff6e550e9 in octave::source_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#16 0x00007ffff6e557be in Fsource(octave_value_list const&, int) ()
    at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#17 0x00007ffff6cb57d5 in octave_builtin::call(octave::tree_evaluator&, int, octave_value_list const&) () at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#18 0x00007ffff6e76fa0 in octave::tree_evaluator::visit_index_expression(octave::tree_index_expression&) () at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#19 0x00007ffff6e562e5 in octave::eval_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, int&, int) () at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#20 0x00007ffff6e568c2 in  () at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#21 0x00007ffff6e574a8 in Fevalin(octave::interpreter&, octave_value_list const&, int) ()
    at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#22 0x00007ffff6cb5f51 in octave_builtin::call(octave::tree_evaluator&, int, octave_value_list const&) () at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#23 0x00007ffff6e76fa0 in octave::tree_evaluator::visit_index_expression(octave::tree_index_expression&) () at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#24 0x00007ffff6d00554 in octave::tree_evaluator::evaluate(octave::tree_expression*, int) ()
    at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
---Type <return> to continue, or q <return> to quit---
#25 0x00007ffff6e74f38 in octave::tree_evaluator::visit_statement(octave::tree_statement&) ()
    at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#26 0x00007ffff6e6b490 in octave::tree_evaluator::visit_statement_list(octave::tree_statement_list&) ()
    at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#27 0x00007ffff6e74ee1 in octave::tree_evaluator::visit_statement(octave::tree_statement&) ()
    at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#28 0x00007ffff6e6b490 in octave::tree_evaluator::visit_statement_list(octave::tree_statement_list&) ()
    at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#29 0x00007ffff6db08fa in octave_user_function::call(octave::tree_evaluator&, int, octave_value_list const&) () at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#30 0x00007ffff6e76fa0 in octave::tree_evaluator::visit_index_expression(octave::tree_index_expression&) () at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#31 0x00007ffff6d00554 in octave::tree_evaluator::evaluate(octave::tree_expression*, int) ()
    at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#32 0x00007ffff6e74f38 in octave::tree_evaluator::visit_statement(octave::tree_statement&) ()
    at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#33 0x00007ffff6e6b490 in octave::tree_evaluator::visit_statement_list(octave::tree_statement_list&) ()
    at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#34 0x00007ffff719ab36 in octave::interpreter::main_loop() ()
    at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#35 0x00007ffff71a1320 in octave::interpreter::execute() ()
    at /usr/lib/x86_64-linux-gnu/liboctinterp.so.5
#36 0x00007ffff79af871 in octave::octave_interpreter::execute() ()
    at /usr/lib/x86_64-linux-gnu/octave/4.3.91/liboctgui.so.3
---Type <return> to continue, or q <return> to quit---
#37 0x00007ffff1e68d02 in QObject::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#38 0x00007ffff2ddf6cc in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#39 0x00007ffff2de6e84 in QApplication::notify(QObject*, QEvent*) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#40 0x00007ffff1e38938 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#41 0x00007ffff1e3b4cd in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#42 0x00007ffff1e93b73 in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#43 0x00007fffe9d7d287 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#44 0x00007fffe9d7d4c0 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#45 0x00007fffe9d7d54c in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#46 0x00007ffff1e9319f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#47 0x00007ffff1e36b6a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#48 0x00007ffff1c4c7ea in QThread::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#49 0x00007ffff1c51b4f in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#50 0x00007ffff435e5aa in start_thread (arg=0x7fffcbfff700) at pthread_create.c:463
#51 0x00007ffff4093cbf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb)
(gdb) q
A debugging session is active.

Inferior 1 [process 8132] will be killed.

Quit anyway? (y or n) y



this was with simple loop just doing srl_read(com, 8)

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lostbard (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-05-14 lostbard StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2018-05-02 lostbard StatusConfirmed Ready For Test
        Assigned toNone lostbard
    2018-05-01 lostbard Release4.3.91 4.4.0
    2018-05-01 lostbard StatusNeed Info Confirmed
    2018-04-28 lostbard StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code