cn-uofbasel / PiCN

PiCN: Python ICN and NFN by University of Basel
BSD 3-Clause "New" or "Revised" License
18 stars 14 forks source link

Software Tests: "Address already in use" #3

Closed cmarxer closed 6 years ago

cmarxer commented 6 years ago

Occasionally, a software test fails due to OS Error "Address already in use":

======================================================================
1) ERROR: Test adding content
----------------------------------------------------------------------
   Traceback (most recent call last):
    /home/claudio/software/PiCN/PiCN/Mgmt/test/test_Mgmt.py line 24 in setUp
      self.linklayer = UDP4LinkLayer(9000+self.portoffset)
    /home/claudio/software/PiCN/PiCN/Layers/LinkLayer/UDP4LinkLayer.py line 25 in __init__
      self.sock.bind(("0.0.0.0", self._port))
   OSError: [Errno 98] Address already in use
blacksheeep commented 6 years ago

Running to many tests. Port selection is already randomized, which doesn't seem to be sufficient. must be changed in some way. OS keeps ports to long open.

blacksheeep commented 6 years ago

I think the solution here is to let the OS choose the port, I start changing the tests to do so.

blacksheeep commented 6 years ago

seems to fix that bug.

cmarxer commented 6 years ago

Now occurs less often, but still:

======================================================================
ERROR: test_fetch_small_data (PiCN.ProgramLibs.ICNDataRepository.test.test_ICNDataRepository.test_ICNDataRepository)
Test fetching a small data object with little chunking
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/claudio/software/PiCN/PiCN/ProgramLibs/ICNDataRepository/test/test_ICNDataRepository.py", line 35, in setUp
    self.fetch = Fetch("127.0.0.1", self.repo_port)
  File "/home/claudio/software/PiCN/PiCN/ProgramLibs/Fetch/Fetch.py", line 28, in __init__
    self.linklayer = UDP4LinkLayer(randint(10000, 64000), debug_level=debug_level)
  File "/home/claudio/software/PiCN/PiCN/Layers/LinkLayer/UDP4LinkLayer.py", line 25, in __init__
    self.sock.bind(("0.0.0.0", self._port))
OSError: [Errno 98] Address already in use
blacksheeep commented 6 years ago

Still got this on this point:

ERROR: test_fetching_content_from_second_repo_after_nack (PiCN.ProgramLibs.Fetch.test.test_Fetch.test_Fetch) Test sending an interest to forwarder with no matching content, choose second route to fetch content

Traceback (most recent call last): File "/Users/christopherscherb/SourceCode/PiCN/PiCN/ProgramLibs/Fetch/test/test_Fetch.py", line 36, in setUp self.ICNRepo: ICNDataRepository = ICNDataRepository("/tmp/repo_unit_test", Name("/test/data"), port=0) File "/Users/christopherscherb/SourceCode/PiCN/PiCN/ProgramLibs/ICNDataRepository/ICNDataRepository.py", line 79, in init repo_prfx=prefix, debug_level=debug_level) File "/Users/christopherscherb/SourceCode/PiCN/PiCN/Mgmt/Mgmt.py", line 34, in init self.mgmt_sock.bind(("127.0.0.1", self._port)) OSError: [Errno 48] Address already in use

cmarxer commented 6 years ago

Doesn't occur any more.