Closed Bug 630599 Opened 14 years ago Closed 14 years ago

Multiple initialized httpd objects are using up multiple ports during test runs

Categories

(Testing Graveyard :: Mozmill, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: aaronmt, Assigned: ahal)

References

Details

(Whiteboard: [mozmill-1.5.2+][mozmill-2.0+])

Attachments

(1 file, 2 obsolete files)

Using 1.5.2RC2 I have noticed that during test-runs that use localhost, multiple ports were being used. Under 1.5.1, we seem to initialize a single server ran on a single port throughout a test-run Example output on ports used by firefox-bin on localhost tcp 0 0 localhost.localdo:43336 *:* LISTEN 2904/firefox-bin tcp 0 0 localhost.localdo:43337 *:* LISTEN 2904/firefox-bin tcp 0 0 localhost.localdo:43338 *:* LISTEN 2904/firefox-bin tcp 0 0 localhost.localdo:43339 *:* LISTEN 2904/firefox-bin tcp 0 0 localhost.localdo:43340 *:* LISTEN 2904/firefox-bin tcp 0 0 localhost.localdo:43341 *:* LISTEN 2904/firefox-bin tcp 0 0 localhost.localdo:43342 *:* LISTEN 2904/firefox-bin tcp 0 0 localhost.localdo:43343 *:* LISTEN 2904/firefox-bin tcp 0 0 localhost.localdo:43344 *:* LISTEN 2904/firefox-bin tcp 0 0 localhost.localdo:43345 *:* LISTEN 2904/firefox-bin Steps to Reproduce 1. Install and setup mozmill 1.5.2rc2 2. Clone http://hg.mozilla.org/qa/mozmill-tests/ 3. mozmill -t firefox/testAwesomebar -b <path to binary>
Assignee: nobody → ahalberstadt
Status: NEW → ASSIGNED
You can list all listened to ports with netstat -lptuc
So the ports aren't getting closed after a module has been run. I'll have to look into whether this is our fault or httpd.js' fault. The relevant code is here: https://github.com/mozautomation/mozmill/blob/hotfix-1.5.2/mozmill/mozmill/extension/resource/modules/frame.js#L331 At this point I don't think that this is the cause for bug 630258. It appears that things have always worked this way and I get all tests passing in the reproduction steps above. As an aside, this code also raises a separate issue. If we ever hit an error getting the httpd server that isn't related to ports, we'll be stuck in an infinite loop. At the very least I think we should limit the number of times we attempt a connection with a new port. However we should probably try to catch the specific exception for a port conflict.
Do we really want to shutdown/start httpd for each single test module? I don't think that this is optimal. It would cause a lot of delays.
(In reply to comment #3) > Do we really want to shutdown/start httpd for each single test module? I don't > think that this is optimal. It would cause a lot of delays. Currently this is not how things work. We already are creating a new httpd object for each test module. I agree that this is not optimal. Unfortunately, after looking into this a bit more, things are even worse than I thought. Not only are we creating a new httpd object for each module, but we aren't stopping the old httpd objects from previous modules. This explains why the ports are being left open. This function never gets called: https://github.com/mozautomation/mozmill/blob/hotfix-1.5.2/mozmill/mozmill/extension/resource/modules/frame.js#L343 and we create a new collector object (which in turn creates a new httpd object) for each test module: https://github.com/mozautomation/mozmill/blob/hotfix-1.5.2/mozmill/mozmill/extension/resource/modules/frame.js#L662 I don't know what the implications of fixing this for 1.5.2 are. I'd recommend at least stopping the httpd server properly for 1.5.2 and then for 2.0 maybe make the httpd server persist across test modules.
This failure has been exposed by the patch on bug 615144. As Andrew told on IRC it was only hidden before.
Keywords: regression
Whiteboard: [mozmill-1.5.2] → [mozmill-1.5.2?]
Whiteboard: [mozmill-1.5.2?] → [mozmill-1.5.2?][mozmill-2.0?]
Used https://developer.mozilla.org/En/Httpd.js/HTTP_server_for_unit_tests for information on how to properly stop the httpd server.
Attachment #508884 - Flags: review?(ctalbert)
Whiteboard: [mozmill-1.5.2?][mozmill-2.0?] → [mozmill-1.5.2+][mozmill-2.0+]
Comment on attachment 508884 [details] [diff] [review] Patch 1.0 - Stop the httpd object after each test module Thanks for jumping on this!
Attachment #508884 - Flags: review?(ctalbert) → review+
I'm actually going to reopen this. I forgot to add a check to make sure that collector.httpd actually exists, so we hit a javascript error when we call the httpd.stop method. Fix is a simple if statement, will have it up in a bit.
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
Attached patch Patch 1.1 (obsolete) — Splinter Review
Check to make sure collector.httpd exists before calling httpd.stop
Attachment #508884 - Attachment is obsolete: true
Attachment #508975 - Flags: review?(fayearthur+bugs)
Attachment #508975 - Attachment is obsolete: true
Attachment #508979 - Flags: review?(fayearthur+bugs)
Attachment #508975 - Flags: review?(fayearthur+bugs)
Comment on attachment 508979 [details] [diff] [review] Patch 1.1 - Check that the collector.httpd exists before calling httpd.stop thanks for the fast fix!
Attachment #508979 - Flags: review?(fayearthur+bugs) → review+
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → FIXED
Works great and the restart issue is also fixed. Marking as verified fixed.
Status: RESOLVED → VERIFIED
Product: Testing → Testing Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: