URL:
  <http://gna.org/bugs/?12052>

                 Summary: On broken pipe, main loop uses an invalid multimap
iterator
                 Project: Wormux
            Submitted by: kurosu
            Submitted on: dimanche 20.07.2008 à 09:48
                Category: Index server
                Severity: 4 - Important
                Priority: 7 - High
                  Status: Confirmed
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
                 Release: r47xx (svn)
         Discussion Lock: Any

    _______________________________________________________

Details:

Stdout of the server (valgrind lines are prefixed with ==22969==):

"""

 1:10| net_data.cpp,179 : Received int: 808335458
 1:10| client.cpp,170 : didn't receive client version string
 1:10|   main.cpp,204 : Nothing received from client 0x45a8990,
disconnecting!
 1:10|   main.cpp,191 : Closind FD 14 from client 0x45a8990

 1:10| net_data.cpp, 65 : Probably leaking FD 14: not connected
 1:10| net_data.cpp, 73 : Disconnected.
 1:10| server.cpp,105 : Connection closed.
 1:10|   main.cpp,198 : 10 connections up!
 1:10| net_data.cpp,179 : Received int: 1
 1:10| net_data.cpp,179 : Received int: 15
 1:10| net_data.cpp,351 : Message of id 1 and size 15
==22969== Invalid read of size 4
==22969==    at 0x804B11C: main (main.cpp:204)
==22969==  Address 0x45A8B5C is 20 bytes inside a block of size 24 free'd
==22969==    at 0x4022096: operator delete(void*) (vg_replace_malloc.c:244)
==22969==    [trucs internes à la STL]
==22969==    by 0x804B9C5: std::multimap<std::string, Client*>::erase
(stl_multimap.h:406)
==22969==    by 0x804D396: Client::SetVersion(std::string const&)
(client.cpp:244)
==22969==    by 0x804D8E9: Client::HandShake(std::string const&)
(client.cpp:100)
==22969==    by 0x804DAC7: Client::HandleMsg(IndexServerMsg)
(client.cpp:175)
==22969==    by 0x8053FD2: NetData::Receive() (net_data.cpp:368)
==22969==    by 0x804B0D6: main (main.cpp:203)
[... autres erreurs valgrind pas plus informatives]
 1:10| net_data.cpp,179 : Received int: 3
 1:10| net_data.cpp,235 : Received string: 0.8
 1:10| client.cpp,174 : client version: 0.8
 1:10| client.cpp, 98 : Version checked successfully
 1:10| client.cpp,230 : Setting version to 0.8
 1:10| client.cpp,254 : Sending signature
 1:10| net_data.cpp,256 : net_data.cpp,256 : ERROR! Connection reset by peer
 1:10| net_data.cpp,256 : net_data.cpp,256 : ERROR! Broken pipe

"""

Bref, on doit garder un itérateur dans main.cpp, mais au cours du
traitement, cet itérateur est invalidé par un erase dans client.cpp

J'ai regardé rapidement, et ce qui se passe: une fois qu'on a la version du
client (ou pas? cf le broken pipe), on efface l'entrée précédente qui
avait "unknown" comment numéro de version dans la multimap<const string&,
Client*>.




    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?12052>

_______________________________________________
  Message posté via/par Gna!
  http://gna.org/


_______________________________________________
Wormux-gna mailing list
[email protected]
https://mail.gna.org/listinfo/wormux-gna

Reply via email to