Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WOInject seems to break ERXApplication.stopPreviousDevInstance() #20

Open
paulhoadley opened this issue Dec 30, 2021 · 0 comments
Open

Comments

@paulhoadley
Copy link

I didn't even realise Wonder had this feature until a couple of days ago: if you're in development mode, launch an app instance on a fixed port, and then later launch another app instance on the same port, Wonder's default behaviour is for the second instance to stop the first (via the stop direct action) and then carry on launching. I had never seen this behaviour before (I regularly see "Address already in use"), and I set out to investigate why.

It seems to be the case that adding WOInject to a Wonder project prevents the catch block here from ever executing:

@Override
public WOAdaptor adaptorWithName(String aClassName, NSDictionary<String, Object> anArgsDictionary) {
	try {
		return super.adaptorWithName(aClassName, anArgsDictionary);
	} catch (NSForwardException e) {
		Throwable rootCause = ERXExceptionUtilities.getMeaningfulThrowable(e);
		if ((rootCause instanceof BindException) && stopPreviousDevInstance()) {
			return super.adaptorWithName(aClassName, anArgsDictionary);
		}
		throw e;
	}
}

Instead of calling stopPreviousDevInstance(), an InjectableApplication logs the exception and then terminates. To reproduce:

  1. Create a test app from the ERXApplication archetype.
  2. Launch first and second instances to a fixed port, confirming that second stops first.
  3. Convert to InjectableApplication and add ApplicationRunner.
  4. Launch first and second instances to a fixed port, confirming that second dies with BindException.

I can't quite see where the exception is being swallowed, and why we don't make it back to the catch block in adaptorWithName().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant