You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by aledsage <gi...@git.apache.org> on 2016/09/22 20:02:55 UTC
[GitHub] brooklyn-server pull request #344: JmxService tests marked as integration
GitHub user aledsage opened a pull request:
https://github.com/apache/brooklyn-server/pull/344
JmxService tests marked as integration
These tests expect a specific port to be available, which may not be true
in a shared jenkins environment. Therefore marking them as "Integration".
Also moves newJmxServiceRetrying into JmxService.
---
Longer term, we could rewrite the JmxService tests in one of two ways (but I suggest we don't tackle those right now):
1. First (and simplest), we could use the `newJmxServiceRetrying` so that it tries different ports until one starts. We'd need to rewrite the test so that the entity didn't hard-code an expected port. We'd first start the `JmxService`, and then set the config/attribute on the entity.
2. We could try to pass in port `0` to the `JmxService` so that it allocates any available port. That looks a bit harder (the port is passed inside the `JMXServiceURL`. A very quick try at missing the port out from that led to other issues with `connectorServer.start()` (and with needing to get the real address that includes the port only after having started the connectorServer).
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/aledsage/brooklyn-server mark-JmxService-tests-as-integration
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/brooklyn-server/pull/344.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #344
----
commit 14b1c0251335d915d6f4813cce14643d9e9ab103
Author: Aled Sage <al...@gmail.com>
Date: 2016-09-22T19:57:08Z
JmxService tests marked as integration
They expect a specific port to be available, which may not be true
in a shared jenkins environment.
Moves newJmxServiceRetrying into JmxService.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server issue #344: JmxService tests marked as integration
Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the issue:
https://github.com/apache/brooklyn-server/pull/344
Marking tests integration is same as deleting them right now so I'd be wary of such changes (integration tests don't get run, let alone on regular basis).
I was able to reproduce this by running two tests in parallel and slowing them down so that while one of them has the JMX port already open the other goes through the port selection process.
I think it's related to this comment - https://github.com/apache/brooklyn-server/blob/master/utils/common/src/main/java/org/apache/brooklyn/util/net/Networking.java#L96-L98. The JMX service binds to `0.0.0.0:40123` while `LocalhostMachineProvisioningLocation.obtainPort` checks `127.0.0.1` for available ports.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server issue #344: JmxService tests marked as integration
Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on the issue:
https://github.com/apache/brooklyn-server/pull/344
Re sneaking the change into #340 - next time can you do it in a separate PR, even if you merge that PR yourself immediately!
---
Maybe it is just the problem of socket `time_wait` status. But I'd have thought it would be more deterministic, and would fail on other environments (rather than just the shared jenkins) if that is the case.
I guess the alternative (that the port is snapped up by another process in the few millisecond window) is pretty unlikely, particularly with unusual port numbers like this!
I wonder if it could be more subtle: the socket might already be in a time_wait state; we call `Networking.isPortAvailable` using `setReuseAddress` so it works; we then call the `JmxService` without `setReuseAddress` and it fails because the original socket is still there in `time_wait` state. Or is that nonsense: does opening a socket with `setReuseAddress` cause the previous time_wait socket to close immediately?
---
I don't particularly like us waiting up to 3 minutes in our test (as per your observation in #329 that we want tests to be fast). I'd prefer (medium-term) if we could retry with different port numbers instead.
But happy to see if your fix works!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server pull request #344: JmxService tests marked as integration
Posted by aledsage <gi...@git.apache.org>.
Github user aledsage closed the pull request at:
https://github.com/apache/brooklyn-server/pull/344
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server issue #344: JmxService tests marked as integration
Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on the issue:
https://github.com/apache/brooklyn-server/pull/344
@ahgittin can you take a look at this please?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server issue #344: JmxService tests marked as integration
Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on the issue:
https://github.com/apache/brooklyn-server/pull/344
Agreed that marking tests as integration is not a good idea right now; hence closing this. If it bites us a lot before we find the time to change it to either use port `0` (so it picks a free port), or to wrap in a retry, or to inject a random numbered port, then we can mark them as `Broken` so that builds don't give us false-negatives.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server issue #344: JmxService tests marked as integration
Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the issue:
https://github.com/apache/brooklyn-server/pull/344
@neykov running two tests in parallel would understandably generate this error. but our test machines don't do that do they ... actually if the boxes do that could explain the problem and a better fix would be to tell it to use port `40000+Math.random(10000)+"+"` (still a 0.01% chance of collision but that's a big improvement!)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server issue #344: JmxService tests marked as integration
Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the issue:
https://github.com/apache/brooklyn-server/pull/344
This is a bad cop out. The tests aren't relying on a specific port. I think the problem is that the `Networking.isPortAvailable()` check isn't releasing the port fast enough and probably the subsequent bind (deep in mbean code) isn't doing `setReuseAddr`.
i've snuck a nasty hack in #340 at e3dd40957867d8083e3e1b2d6d278125009048f6 . if that works i'd prefer that to this. if not we should take a quick look (stack trace in commit above) to see if we can turn on reuse_addr for mbean. if that fails then we could do this until we support your long-term 2 which is the right way, let jmx service pick the port and then we plug that sensor in everywhere else it's needed (but as you say quite a lot of work and not worth it as this code is pretty solid and unchanging)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server issue #344: JmxService tests marked as integration
Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the issue:
https://github.com/apache/brooklyn-server/pull/344
They do actually - there are multiple jobs running the tests (server-master, build-master, server-master-pull-requests).
Still I think fixing the free port checking logic is better than picking a random port. There's nothing stopping another project's builds to allocate a block of ports for it's own use and fail our tests.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server issue #344: JmxService tests marked as integration
Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on the issue:
https://github.com/apache/brooklyn-server/pull/344
Closing this. We'll see if the
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---