Opened 4 years ago

Closed 4 years ago

#3572 closed defect (fixed)

Cannot restart UI test environment if Python keeps port open

Reported by: greiner Assignee: greiner
Priority: P3 Milestone:
Module: User-Interface Keywords:
Cc: Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29334529/

Description (last modified by greiner)

Environment

Ubuntu 14.04

How to reproduce

  1. Start test server with ./test_server.py
  2. Open http://localhost:5000/options.html
  3. Kill process using CTRL+C

Observed behavior

Console shows the following error message:

socket.error: [Errno 98] Address already in use

Expected behavior

Server should start up normally without any error messages being shown.

Background

Python keeps ports open in case any extra packets show up so telling it to reuse those should be sufficient. However, that requires us to manually bind to the port.

What to change

  • Set the third argument in the server constructor to False to indicate that we want to bind to the port manually.
  • Set the server's allow_reuse_address property to True.
  • Call server_bind() and server_activate() before starting the server.

Change History (5)

comment:1 Changed 4 years ago by greiner

  • Description modified (diff)

comment:2 Changed 4 years ago by greiner

  • Description modified (diff)

comment:3 Changed 4 years ago by greiner

  • Owner set to greiner

comment:4 Changed 4 years ago by greiner

  • Status changed from new to reviewing

comment:5 Changed 4 years ago by greiner

  • Resolution set to fixed
  • Review URL(s) modified (diff)
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.