Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Assorted errors when using threads (1 new simulation per thread)

Hi,
I added now another parameter to traci.start which can prevent switching
to the new connection. It works here with your example. Please try with
a nightly build (or git pull) whether it now solves your problem if you
set switch=False in traci.start.

Best regards,
Michael

Am 16.05.21 um 09:18 schrieb Michael Behrisch:
> Hi,
> I could reproduce the error, see
> https://github.com/eclipse/sumo/issues/8630 but I am not sure yet what
> causes it. A possible workaround is to use traci.connect instead of
> traci.start but I agree that this is inconvenient because you would need
> to do the sumo startup yourself.
> 
> Best regards,
> Michael
> 
> Am 12.05.21 um 18:16 schrieb Marcelo Andrade Rodrigues D Almeida:
>> Hi Harald
>>
>> Thank you for giving it a try
>>
>> This version gives the same error output for me. I'm hoping it has the
>> same root cause from the errors I found in the previous code version.
>> Thank you for the additional information
>>
>>
>> Michael, could you reproduce the error? Let me know if you found or need
>> anything
>>
>>
>> Thank you all once again
>>
>> Sincerely,
>>
>> Marcelo d'Almeida
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Wed, May 12, 2021 at 4:04 AM Harald Schaefer <fechsaer@xxxxxxxxx
>> <mailto:fechsaer@xxxxxxxxx>> wrote:
>>
>>     Hi Michael and Marcelo,
>>
>>     with the latest version of the example I could reproduce the error.
>>
>>     With some changes to sumo_env.py
>>
>>     *** sumo_env.py 2021-05-12 08:29:23.260183300 +0200
>>     --- sumo_env.py.orig    2021-05-10 14:22:32.000000000 +0200
>>     ***************
>>     *** 283,287 ****
>>               sumo_binary = self.get_sumo_binary(gui=False)
>>     !         sumo_cmd = []
>>     !         sumo_cmd.extend(['gdb', '-ex', 'run', '--args'])
>>     !         sumo_cmd.extend([sumo_binary, *sumocfg_parameters_list])
>>      
>>     --- 283,285 ----
>>               sumo_binary = self.get_sumo_binary(gui=False)
>>     !         sumo_cmd = [sumo_binary, *sumocfg_parameters_list]
>>
>>      I run all sumo's with gdb and I got
>>
>>     SUMO VERSION SUMO v1_9_1+0287-bf4d10a8fa
>>     Step #0.00Error: Answered with error to command 0xa4: Vehicle
>>     '-gneE1__gneE0__light.0' is not known.
>>     Error: Answered with error to command 0xa4: Vehicle
>>     '-gneE1__gneE0__light.0' is not known.
>>     Error: Answered with error to command 0xa4: Vehicle
>>     '-gneE1__gneE0__light.0' is not known.
>>     Error: Answered with error to command 0xa4: Vehicle
>>     '-gneE1__gneE0__light.0' is not known.
>>     Error: Answered with error to command 0xa4: Vehicle
>>     '-gneE1__gneE0__light.0' is not known.
>>     Error: Answered with error to command 0xa4: Vehicle
>>     '-gneE1__gneE0__light.0' is not known.
>>     Error: Answered with error to command 0xa4: Vehicle
>>     '-gneE1__gneE0__light.0' is not known.
>>     Error: Answered with error to command 0xa4: Vehicle
>>     '-gneE1__gneE0__light.0' is not known.
>>     Error: Answered with error to command 0xa4: Vehicle
>>     '-gneE1__gneE0__light.0' is not known.
>>     Error: Answered with error to command 0xa4: Vehicle
>>     '-gneE1__gneE0__light.0' is not known.
>>     Error: Answered with error to command 0xa4: Vehicle
>>     '-gneE1__gneE0__light.0' is not known.
>>     Error: Answered with error to command 0xa4: Vehicle
>>     '-gneE1__gneE0__light.0' is not known.
>>     Error: Answered with error to command 0xa4: Vehicle
>>     '-gneE1__gneE0__light.0' is not known.
>>     Error: Answered with error to command 0xd4: Could not add
>>     subscription. Vehicle '-gneE1__gneE0__light.0' is not known.Vehicle
>>     '-gneE1__gneE0__light.0' is not known.Vehicle
>>     '-gneE1__gneE0__light.0' is not known.Vehicle
>>     '-gneE1__gneE0__light.0' is not known.Vehicle
>>     '-gneE1__gneE0__light.0' is not known.Vehicle
>>     '-gneE1__gneE0__light.0' is not known.Vehicle
>>     '-gneE1__gneE0__light.0' is not known.Vehicle
>>     '-gneE1__gneE0__light.0' is not known.Vehicle
>>     '-gneE1__gneE0__light.0' is not known.Vehicle
>>     '-gneE1__gneE0__light.0' is not known.Vehicle
>>     '-gneE1__gneE0__light.0' is not known.Vehicle
>>     '-gneE1__gneE0__light.0' is not known.Vehicle
>>     '-gneE1__gneE0__light.0' is not known.
>>     Error: Storage::writeUnsignedByte(): Invalid value, not in [0, 255]
>>     Quitting (on error).
>>     [Thread 0x7ffff35f0640 (LWP 9453) exited]
>>     [Thread 0x7ffff2def640 (LWP 9454) exited]
>>     [Thread 0x7ffff25ee640 (LWP 9455) exited]
>>     [Thread 0x7ffff1ded640 (LWP 9456) exited]
>>     malloc_consolidate(): unaligned fastbin chunk detected
>>     connection closed by SUMO
>>
>>     Thread 1 "sumo" received signal SIGABRT, Aborted.
>>     __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
>>     49      ../sysdeps/unix/sysv/linux/raise.c: Datei oder Verzeichnis
>>     nicht gefunden.
>>
>>     [1]+  Angehalten              example.py
>>     harald@csx> jobs
>>     [1]+  Angehalten              example.py
>>     harald@csx> fg
>>     example.py
>>     (gdb) bt
>>     #0  __GI_raise (sig=sig@entry=6) at
>>     ../sysdeps/unix/sysv/linux/raise.c:49
>>     #1  0x00007ffff6f93864 in __GI_abort () at abort.c:79
>>     #2  0x00007ffff6ff6736 in __libc_message
>>     (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff711bb9c "%s\n")
>>     at ../sysdeps/posix/libc_fatal.c:155
>>     #3  0x00007ffff6fff08c in malloc_printerr
>>     (str=str@entry=0x7ffff711df68 "malloc_consolidate(): unaligned
>>     fastbin chunk detected") at malloc.c:5628
>>     #4  0x00007ffff700076c in malloc_consolidate
>>     (av=av@entry=0x7ffff714dba0 <main_arena>) at malloc.c:4709
>>     #5  0x00007ffff7000f80 in _int_free (av=0x7ffff714dba0 <main_arena>,
>>     p=0x55555663a230, have_lock=<optimized out>) at malloc.c:4633
>>     #6  0x00007ffff70047a8 in __GI___libc_free (mem=<optimized out>) at
>>     malloc.c:3309
>>     #7  0x00007ffff7df4662 in
>>     xercesc_3_2::ValidationContextImpl::~ValidationContextImpl() () from
>>     /lib/x86_64-linux-gnu/libxerces-c-3.2.so <http://libxerces-c-3.2.so>
>>     #8  0x00007ffff7df467d in
>>     xercesc_3_2::ValidationContextImpl::~ValidationContextImpl() () from
>>     /lib/x86_64-linux-gnu/libxerces-c-3.2.so <http://libxerces-c-3.2.so>
>>     #9  0x00007ffff7e6ca27 in xercesc_3_2::SchemaInfo::~SchemaInfo() ()
>>     from /lib/x86_64-linux-gnu/libxerces-c-3.2.so
>>     <http://libxerces-c-3.2.so>
>>     #10 0x00007ffff7ddaed8 in
>>     xercesc_3_2::RefHash2KeysTableOf<xercesc_3_2::SchemaInfo,
>>     xercesc_3_2::StringHasher>::removeAll() () from
>>     /lib/x86_64-linux-gnu/libxerces-c-3.2.so <http://libxerces-c-3.2.so>
>>     #11 0x00007ffff7dd578e in xercesc_3_2::IGXMLScanner::cleanUp() ()
>>     from /lib/x86_64-linux-gnu/libxerces-c-3.2.so
>>     <http://libxerces-c-3.2.so>
>>     #12 0x00007ffff7dd581b in xercesc_3_2::IGXMLScanner::~IGXMLScanner()
>>     () from /lib/x86_64-linux-gnu/libxerces-c-3.2.so
>>     <http://libxerces-c-3.2.so>
>>     #13 0x00007ffff7dd584d in xercesc_3_2::IGXMLScanner::~IGXMLScanner()
>>     () from /lib/x86_64-linux-gnu/libxerces-c-3.2.so
>>     <http://libxerces-c-3.2.so>
>>     #14 0x00007ffff7e27163 in xercesc_3_2::SAX2XMLReaderImpl::cleanUp()
>>     () from /lib/x86_64-linux-gnu/libxerces-c-3.2.so
>>     <http://libxerces-c-3.2.so>
>>     #15 0x00007ffff7e29a66 in
>>     xercesc_3_2::SAX2XMLReaderImpl::~SAX2XMLReaderImpl() () from
>>     /lib/x86_64-linux-gnu/libxerces-c-3.2.so <http://libxerces-c-3.2.so>
>>     #16 0x00007ffff7e29a7d in
>>     xercesc_3_2::SAX2XMLReaderImpl::~SAX2XMLReaderImpl() () from
>>     /lib/x86_64-linux-gnu/libxerces-c-3.2.so <http://libxerces-c-3.2.so>
>>     #17 0x0000555555cb0d9c in SUMOSAXReader::~SUMOSAXReader() ()
>>     #18 0x0000555555cc45b4 in XMLSubSys::close() ()
>>     #19 0x0000555555d0a097 in SystemFrame::close() ()
>>     #20 0x000055555574c388 in main ()
>>
>>     Running with valgrind I got
>>
>>     connection closed by SUMO
>>     ==15450== Invalid write of size 8
>>     ==15450==    at 0x433D64: TraCIServer::cleanup() (in
>>     /usr/local/bin/sumo)
>>     ==15450==    by 0x437089: TraCIServer::~TraCIServer() (in
>>     /usr/local/bin/sumo)
>>     ==15450==    by 0x4373DC: TraCIServer::~TraCIServer() (in
>>     /usr/local/bin/sumo)
>>     ==15450==    by 0x437408: TraCIServer::close() (in /usr/local/bin/sumo)
>>     ==15450==    by 0x300382: main (in /usr/local/bin/sumo)
>>     ==15450==  Address 0x9fd9130 is 0 bytes inside a block of size 112
>>     free'd
>>     ==15450==    at 0x484584F: operator delete(void*) (in
>>     /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
>>     ==15450==    by 0x437060: TraCIServer::~TraCIServer() (in
>>     /usr/local/bin/sumo)
>>     ==15450==    by 0x4373DC: TraCIServer::~TraCIServer() (in
>>     /usr/local/bin/sumo)
>>     ==15450==    by 0x437408: TraCIServer::close() (in /usr/local/bin/sumo)
>>     ==15450==    by 0x300382: main (in /usr/local/bin/sumo)
>>     ==15450==  Block was alloc'd at
>>     ==15450==    at 0x4842FB3: operator new(unsigned long) (in
>>     /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
>>     ==15450==    by 0x43CD8B: TraCIServer::TraCIServer(long long, int,
>>     int) (in /usr/local/bin/sumo)
>>     ==15450==    by 0x43FD87: TraCIServer::openSocket(std::map<int, bool
>>     (*)(TraCIServer&, tcpip::Storage&, tcpip::Storage&), std::less<int>,
>>     std::allocator<std::pair<int const, bool (*)(TraCIServer&,
>>     tcpip::Storage&, tcpip::Storage&)> > > const&) (in /usr/local/bin/sumo)
>>     ==15450==    by 0x5348CF: NLBuilder::init(bool) (in /usr/local/bin/sumo)
>>     ==15450==    by 0x300286: main (in /usr/local/bin/sumo)
>>
>>     I hope this helps
>>
>>     Best regards, Harald
>>
>>     Am 10.05.21 um 19:35 schrieb Marcelo Andrade Rodrigues D Almeida:
>>>     Hi Michael
>>>
>>>     See the slightly changed attached example.
>>>
>>>     Thank you
>>>
>>>
>>>     Sincerely,
>>>
>>>     Marcelo d'Almeida
>>>
>>>     On Sun, May 9, 2021 at 8:06 AM Michael Behrisch <oss@xxxxxxxxxxx
>>>     <mailto:oss@xxxxxxxxxxx>> wrote:
>>>
>>>         Hi,
>>>         I just ran it from the command line not in an IDE. I probably
>>>         won't be
>>>         able to reproduce it if it just occurs in an IDE. Does it
>>>         occur at all
>>>         if you run from the command line (or without breakpoints)?
>>>
>>>         Best regards,
>>>         Michael
>>>
>>>         Am 06.05.21 um 17:27 schrieb Marcelo Andrade Rodrigues D Almeida:
>>>         > Hi Michael
>>>         >
>>>         > Thank you for your reply
>>>         >
>>>         > I tested again with the daily version and the errors still
>>>         happen when
>>>         > putting a breakpoint (e.g., sumo_env.py l. 111)
>>>         >
>>>         > The errors occur more frequently when using Pycharm
>>>         (2020.1.5 community)
>>>         > than using vscode (1.56.0). I'm not sure why. I'm using
>>>         Python 3.6 on
>>>         > Linux (Ubuntu 20.04).
>>>         >
>>>         > Did you test with breakpoints too?
>>>         >
>>>         > Thank you
>>>         >
>>>         >
>>>         > Sincerely,
>>>         >
>>>         > Marcelo d'Almeida
>>>         >
>>>         >
>>>         > On Mon, May 3, 2021 at 10:05 AM Michael Behrisch
>>>         <oss@xxxxxxxxxxx <mailto:oss@xxxxxxxxxxx>
>>>         > <mailto:oss@xxxxxxxxxxx <mailto:oss@xxxxxxxxxxx>>> wrote:
>>>         >
>>>         >     Hi,
>>>         >     I ran your example here (Python 3.6 on Linux), with the
>>>         most recent
>>>         >     SUMO
>>>         >     (built today) changing max_workers to 2 and experienced
>>>         no problems.
>>>         >
>>>         >     Can you give more details on your environment?
>>>         >
>>>         >     Best regards,
>>>         >     Michael
>>>         >
>>>         >     Am 29.04.21 um 15:19 schrieb Marcelo Andrade Rodrigues D
>>>         Almeida:
>>>         >      > Thank you for your response
>>>         >      >
>>>         >      > See new attached version
>>>         >      >
>>>         >      >
>>>         >      > Sincerely,
>>>         >      >
>>>         >      > Marcelo d'Almeida
>>>         >      >
>>>         >      >
>>>         >      > On Thu, Apr 29, 2021 at 10:12 AM Michael Behrisch
>>>         >     <oss@xxxxxxxxxxx <mailto:oss@xxxxxxxxxxx>
>>>         <mailto:oss@xxxxxxxxxxx <mailto:oss@xxxxxxxxxxx>>
>>>         >      > <mailto:oss@xxxxxxxxxxx <mailto:oss@xxxxxxxxxxx>
>>>         <mailto:oss@xxxxxxxxxxx <mailto:oss@xxxxxxxxxxx>>>> wrote:
>>>         >      >
>>>         >      >     Hi,
>>>         >      >     in your example code the synchronization_util is
>>>         missing. Can you
>>>         >      >     add it
>>>         >      >     and resend the zip?
>>>         >      >
>>>         >      >     Best regards,
>>>         >      >     Michael
>>>         >      >
>>>         >      >     Am 25.04.21 um 22:45 schrieb Marcelo Andrade
>>>         Rodrigues D Almeida:
>>>         >      >      > Hi everyone
>>>         >      >      >
>>>         >      >      > I'm having trouble using multiple simulations
>>>         in different
>>>         >     threads
>>>         >      >      >
>>>         >      >      > The difference can be perceived by changing
>>>         max_workers to
>>>         >     1 and 2.
>>>         >      >      > "        with
>>>         >      >   
>>>          ThreadPoolExecutor(max_workers=len(possible_actions)) as
>>>         >      >      > executor:" (planning_only_agent.py, line 100)
>>>         >      >      >
>>>         >      >      > [See attached example (a very simplified
>>>         version of what I'm
>>>         >      >     actually
>>>         >      >      > using)]
>>>         >      >      >
>>>         >      >      > With max_workers=1, it works just fine.
>>>         >      >      >
>>>         >      >      > With 2, it gives all sort of errors:
>>>         >      >      >
>>>         >      >      > "bad char in struct format"
>>>         >      >      > "unpack requires a buffer of [x] bytes"
>>>         >      >      > A lot of times it just hangs
>>>         >      >      > "Received answer 0 for command 211."
>>>         >      >      >
>>>         >      >      >
>>>         >      >      > The easiest way I found to reproduce is to add a
>>>         >     breakpoint into a
>>>         >      >      > subscribe call and hit continue several times.
>>>         It is
>>>         >     likely to crash
>>>         >      >      > when threads stop at the same command,
>>>         although it occurs
>>>         >     eventually
>>>         >      >      > without breaking points.
>>>         >      >      >
>>>         >      >      > Tested in version 1.9.0 (specifically
>>>         v1_9_0+0210-fa53508669)
>>>         >      >      >
>>>         >      >      > Thank you in advance
>>>         >      >      >
>>>         >      >      >
>>>         >      >      > Sincerely,
>>>         >      >      >
>>>         >      >      > Marcelo d'Almeida
>>>         >      >      >
>>>         >      >      > _______________________________________________
>>>         >      >      > sumo-user mailing list
>>>         >      >      > sumo-user@xxxxxxxxxxx
>>>         <mailto:sumo-user@xxxxxxxxxxx> <mailto:sumo-user@xxxxxxxxxxx
>>>         <mailto:sumo-user@xxxxxxxxxxx>>
>>>         >     <mailto:sumo-user@xxxxxxxxxxx
>>>         <mailto:sumo-user@xxxxxxxxxxx> <mailto:sumo-user@xxxxxxxxxxx
>>>         <mailto:sumo-user@xxxxxxxxxxx>>>
>>>         >      >      > To unsubscribe from this list, visit
>>>         >      > https://www.eclipse.org/mailman/listinfo/sumo-user
>>>         <https://www.eclipse.org/mailman/listinfo/sumo-user>
>>>         >     <https://www.eclipse.org/mailman/listinfo/sumo-user
>>>         <https://www.eclipse.org/mailman/listinfo/sumo-user>>
>>>         >      >   
>>>          <https://www.eclipse.org/mailman/listinfo/sumo-user
>>>         <https://www.eclipse.org/mailman/listinfo/sumo-user>
>>>         >     <https://www.eclipse.org/mailman/listinfo/sumo-user
>>>         <https://www.eclipse.org/mailman/listinfo/sumo-user>>>
>>>         >      >      >
>>>         >      >     _______________________________________________
>>>         >      >     sumo-user mailing list
>>>         >      > sumo-user@xxxxxxxxxxx <mailto:sumo-user@xxxxxxxxxxx>
>>>         <mailto:sumo-user@xxxxxxxxxxx <mailto:sumo-user@xxxxxxxxxxx>>
>>>         >     <mailto:sumo-user@xxxxxxxxxxx
>>>         <mailto:sumo-user@xxxxxxxxxxx> <mailto:sumo-user@xxxxxxxxxxx
>>>         <mailto:sumo-user@xxxxxxxxxxx>>>
>>>         >      >     To unsubscribe from this list, visit
>>>         >      > https://www.eclipse.org/mailman/listinfo/sumo-user
>>>         <https://www.eclipse.org/mailman/listinfo/sumo-user>
>>>         >     <https://www.eclipse.org/mailman/listinfo/sumo-user
>>>         <https://www.eclipse.org/mailman/listinfo/sumo-user>>
>>>         >      >   
>>>          <https://www.eclipse.org/mailman/listinfo/sumo-user
>>>         <https://www.eclipse.org/mailman/listinfo/sumo-user>
>>>         >     <https://www.eclipse.org/mailman/listinfo/sumo-user
>>>         <https://www.eclipse.org/mailman/listinfo/sumo-user>>>
>>>         >      >
>>>         >      >
>>>         >      > _______________________________________________
>>>         >      > sumo-user mailing list
>>>         >      > sumo-user@xxxxxxxxxxx <mailto:sumo-user@xxxxxxxxxxx>
>>>         <mailto:sumo-user@xxxxxxxxxxx <mailto:sumo-user@xxxxxxxxxxx>>
>>>         >      > To unsubscribe from this list, visit
>>>         >     https://www.eclipse.org/mailman/listinfo/sumo-user
>>>         <https://www.eclipse.org/mailman/listinfo/sumo-user>
>>>         >     <https://www.eclipse.org/mailman/listinfo/sumo-user
>>>         <https://www.eclipse.org/mailman/listinfo/sumo-user>>
>>>         >      >
>>>         >     _______________________________________________
>>>         >     sumo-user mailing list
>>>         >     sumo-user@xxxxxxxxxxx <mailto:sumo-user@xxxxxxxxxxx>
>>>         <mailto:sumo-user@xxxxxxxxxxx <mailto:sumo-user@xxxxxxxxxxx>>
>>>         >     To unsubscribe from this list, visit
>>>         >     https://www.eclipse.org/mailman/listinfo/sumo-user
>>>         <https://www.eclipse.org/mailman/listinfo/sumo-user>
>>>         >     <https://www.eclipse.org/mailman/listinfo/sumo-user
>>>         <https://www.eclipse.org/mailman/listinfo/sumo-user>>
>>>         >
>>>         >
>>>         > _______________________________________________
>>>         > sumo-user mailing list
>>>         > sumo-user@xxxxxxxxxxx <mailto:sumo-user@xxxxxxxxxxx>
>>>         > To unsubscribe from this list, visit
>>>         https://www.eclipse.org/mailman/listinfo/sumo-user
>>>         <https://www.eclipse.org/mailman/listinfo/sumo-user>
>>>         >
>>>         _______________________________________________
>>>         sumo-user mailing list
>>>         sumo-user@xxxxxxxxxxx <mailto:sumo-user@xxxxxxxxxxx>
>>>         To unsubscribe from this list, visit
>>>         https://www.eclipse.org/mailman/listinfo/sumo-user
>>>         <https://www.eclipse.org/mailman/listinfo/sumo-user>
>>>
>>>
>>>     _______________________________________________
>>>     sumo-user mailing list
>>>     sumo-user@xxxxxxxxxxx <mailto:sumo-user@xxxxxxxxxxx>
>>>     To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user <https://www.eclipse.org/mailman/listinfo/sumo-user>
>>     _______________________________________________
>>     sumo-user mailing list
>>     sumo-user@xxxxxxxxxxx <mailto:sumo-user@xxxxxxxxxxx>
>>     To unsubscribe from this list, visit
>>     https://www.eclipse.org/mailman/listinfo/sumo-user
>>     <https://www.eclipse.org/mailman/listinfo/sumo-user>
>>
>>
>> _______________________________________________
>> sumo-user mailing list
>> sumo-user@xxxxxxxxxxx
>> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
>>
> 
> _______________________________________________
> sumo-user mailing list
> sumo-user@xxxxxxxxxxx
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
> 



Back to the top