Hello, David.
Patch on MultiThreadIO branch was help for me.
Thank you very much!

P.S.
I close only explicitly all sockets.

ср, 26 дек. 2018 г. в 14:45, David Matthews <david.matth...@prolingua.co.uk>:
>
> I've had a look at this and I think I know what is going wrong.  There
> is a global table that holds information about open streams.  There is
> an interlock to prevent two threads both growing the table at the same
> time but it turns out there is no interlock to prevent one thread
> growing it while another thread is reading an entry.  I've fixed this
> and pushed some changes to a MultiThreadIO branch on GitHub.
>
> However, the table itself is really a relic of some very old code and
> the whole thing needs to be replaced.  The table does two things.  One
> is to ensure that streams are not persistent: i.e. if a stream is opened
> and a reference to the stream is saved using PolyML.SaveState.saveState
> or PolyML.export then any attempt to use it when the saved state is
> reloaded will fail with an exception.  The other use of the table is to
> enable streams to be garbage-collected: i.e. if a stream is no longer
> reachable then at some point the stream will be closed.
>
> Achieving non-persistence is easy as a result of some recent changes.
> Garbaging-collecting streams is more difficult.  Does anyone actually
> rely on streams being garbage-collected?  Would doing away with that and
> requiring streams to be closed explicitly cause any problems?
>
> David
>
> On 24/12/2018 16:20, Kostirya wrote:
> > Hello.
> > I got sometimes Segmentation fault.
> > The GDB backtrace of core file is bellow.
> > It is multi thread server. I call Socket.bind and Socket.listen in
> > main thread and then I create worker threads.
> > If server have one worker thread then error is not occur.
> >
> >
> > OS is CentOS, Poly/ML 5.7.2 Testing (Git version v5.7.1-161-g33045f8)
> >
> > #0  0x00007fbf878faa87 in get_stream(PolyWord) ()
> >     from /home/nick/polyml/lib/libpolyml.so.9
> > #1  0x00007fbf878fac32 in writeArray(TaskData*, SaveVecEntry*,
> > SaveVecEntry*, bool) [clone .isra.7] () from
> > /home/nick/polyml/lib/libpolyml.so.9
> > #2  0x00007fbf878fc0be in IO_dispatch_c(TaskData*, SaveVecEntry*,
> > SaveVecEntry*, SaveVecEntry*) () from
> > /home/nick/polyml/lib/libpolyml.so.9
> > #3  0x00007fbf878fd2a1 in PolyBasicIOGeneral ()
> >     from /home/nick/polyml/lib/libpolyml.so.9
> > #4  0x000000000041406d in area1 ()
> > #5  0x0000000000002001 in ?? ()
> > #6  0x00007fbf87b57320 in ?? () from /home/nick/polyml/lib/libpolyml.so.9
> > #7  0x00007fbf81e49e30 in ?? ()
> > #8  0x0000000000006001 in ?? ()
> > #9  0x0000000000010008 in ?? ()
> > #10 0x00007fbf879171ed in Processes::FindAllocationSpace(TaskData*,
> > unsigned long, bool) () from /home/nick/polyml/lib/libpolyml.so.9
> > #11 0x00007fbf7c00a4d0 in ?? ()
> > #12 0x00007fbf81e4a660 in ?? ()
> > #13 0x00007fbf8792c9f1 in X86TaskData::SwitchToPoly() ()
> >     from /home/nick/polyml/lib/libpolyml.so.9
> > #14 0x00007fbf8792cbcc in X86TaskData::EnterPolyCode() ()
> >     from /home/nick/polyml/lib/libpolyml.so.9
> > #15 0x00007fbf87916fc9 in NewThreadFunction(void*) ()
> >
> >
> > ==============================================================
> >
> > This one more backtrace.
> >
> > #0  0x00007ff5a378ba87 in get_stream(PolyWord) ()
> >     from /home/nick/polyml/lib/libpolyml.so.9
> > #1  0x00007ff5a379ef08 in getSelectResult(TaskData*, SaveVecEntry*,
> > int, WaitSelect*) () from /home/nick/polyml/lib/libpolyml.so.9
> > #2  0x00007ff5a379f481 in selectCall(TaskData*, SaveVecEntry*, int) ()
> >     from /home/nick/polyml/lib/libpolyml.so.9
> > #3  0x00007ff5a37a03ed in Net_dispatch_c(TaskData*, SaveVecEntry*,
> > SaveVecEntry*) () from /home/nick/polyml/lib/libpolyml.so.9
> > #4  0x00007ff5a37a12f7 in PolyNetworkGeneral ()
> >     from /home/nick/polyml/lib/libpolyml.so.9
> > #5  0x00000000004078a2 in area1 ()
> > #6  0x0000000000002001 in ?? ()
> > #7  0x00007ff5a39e8320 in ?? () from /home/nick/polyml/lib/libpolyml.so.9
> > #8  0x00007ff59d4d9e30 in ?? ()
> > #9  0x000000000000a001 in ?? ()
> > #10 0x0000000000010008 in ?? ()
> > #11 0x00007ff5a37a81ed in Processes::FindAllocationSpace(TaskData*,
> > unsigned long, bool) () from /home/nick/polyml/lib/libpolyml.so.9
> > #12 0x00007ff59800c980 in ?? ()
> > #13 0x00007ff59d4da660 in ?? ()
> > #14 0x00007ff5a37bd9f1 in X86TaskData::SwitchToPoly() ()
> >     from /home/nick/polyml/lib/libpolyml.so.9
> > #15 0x00007ff5a37bdbcc in X86TaskData::EnterPolyCode() ()
> > ---Type <return> to continue, or q <return> to quit---
> >     from /home/nick/polyml/lib/libpolyml.so.9
> > #16 0x00007ff5a37a7fc9 in NewThreadFunction(void*) ()
> >     from /home/nick/polyml/lib/libpolyml.so.9
> > #17 0x00007ff5a2968e25 in start_thread () from /lib64/libpthread.so.0
> > #18 0x00007ff5a2c7534d in clone () from /lib64/libc.so.6
> >
> >
> > ==============================================================
> >
> > This one more backtrace.
> >
> >
> > #0  0x00007f88d2be3a87 in get_stream(PolyWord) () from
> > /home/nick/polyml/lib/libpolyml.so.9
> > #1  0x00007f88d2be5b85 in IO_dispatch_c(TaskData*, SaveVecEntry*,
> > SaveVecEntry*, SaveVecEntry*) ()
> >     from /home/nick/polyml/lib/libpolyml.so.9
> > #2  0x00007f88d2be62a1 in PolyBasicIOGeneral () from
> > /home/nick/polyml/lib/libpolyml.so.9
> > #3  0x000000000040580d in area1 ()
> > #4  0x0000000000002001 in ?? ()
> > #5  0x00007f88d2e40320 in ?? () from /home/nick/polyml/lib/libpolyml.so.9
> > #6  0x00007f88cc931e30 in ?? ()
> > #7  0x000000000000a001 in ?? ()
> > #8  0x0000000000010008 in ?? ()
> > #9  0x00007f88d2c001ed in Processes::FindAllocationSpace(TaskData*,
> > unsigned long, bool) () from /home/nick/polyml/lib/libpolyml.so.9
> > #10 0x00007f88c800c980 in ?? ()
> > #11 0x00007f88cc932660 in ?? ()
> > #12 0x00007f88d2c159f1 in X86TaskData::SwitchToPoly() () from
> > /home/nick/polyml/lib/libpolyml.so.9
> > #13 0x00007f88d2c15bcc in X86TaskData::EnterPolyCode() () from
> > /home/nick/polyml/lib/libpolyml.so.9
> > #14 0x00007f88d2bfffc9 in NewThreadFunction(void*) () from
> > /home/nick/polyml/lib/libpolyml.so.9
> > #15 0x00007f88d1dc0e25 in start_thread () from /lib64/libpthread.so.0
> > #16 0x00007f88d20cd34d in clone () from /lib64/libc.so.6
> >
> >
> > =====================================================================
> >
> > This one more backtrace.
> >
> >
> > #0  0x00007f1ed86fca87 in get_stream(PolyWord) ()
> >     from /home/nick/polyml/lib/libpolyml.so.9
> > #1  0x00007f1ed8710209 in selectCall(TaskData*, SaveVecEntry*, int) ()
> >     from /home/nick/polyml/lib/libpolyml.so.9
> > #2  0x00007f1ed87113ed in Net_dispatch_c(TaskData*, SaveVecEntry*,
> > SaveVecEntry*) () from /home/nick/polyml/lib/libpolyml.so.9
> > #3  0x00007f1ed87122f7 in PolyNetworkGeneral ()
> >     from /home/nick/polyml/lib/libpolyml.so.9
> > #4  0x00000000004078a2 in area1 ()
> > #5  0x0000000000002001 in ?? ()
> > #6  0x00007f1ed8959320 in ?? () from /home/nick/polyml/lib/libpolyml.so.9
> > #7  0x00007f1ecdffae30 in ?? ()
> > #8  0x000000000000a001 in ?? ()
> > #9  0x0000000000010008 in ?? ()
> > #10 0x00007f1ed87191ed in Processes::FindAllocationSpace(TaskData*,
> > unsigned long, bool) () from /home/nick/polyml/lib/libpolyml.so.9
> > #11 0x00007f1ed000c980 in ?? ()
> > #12 0x00007f1ecdffb660 in ?? ()
> > #13 0x00007f1ed872e9f1 in X86TaskData::SwitchToPoly() ()
> >     from /home/nick/polyml/lib/libpolyml.so.9
> > #14 0x00007f1ed872ebcc in X86TaskData::EnterPolyCode() ()
> >     from /home/nick/polyml/lib/libpolyml.so.9
> > #15 0x00007f1ed8718fc9 in NewThreadFunction(void*) ()
> > _______________________________________________
> > polyml mailing list
> > polyml@inf.ed.ac.uk
> > http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
> >
_______________________________________________
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to