Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Exit JVM if an error is thrown or the main loop exits #119

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ANeumann82
Copy link

@ANeumann82 ANeumann82 commented Oct 30, 2019

Fixed some timeout issues on startup
Fixed issues with PodIds containing .
Exit JVM if an error is thrown or the main loop exits

JIRA issues: DCOS_OSS-5633

Fixed issues with PodIds containing .
Exit JVM if an error is thrown or the main loop exits
@@ -33,4 +33,17 @@ akka {
# outgoing connection might be closed if no call is issued to Mesos for a while
idle-timeout = infinite
}
}

stream {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a library, I feel like we shouldn't rely on putting global configuration here for Akka. We should instead be adding the appropriate catch-all error catching (which will expose exceptions properly).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that does make sense, and I think you're correct there. I couldn't really figure out why we actually need that increased timeout, something slows down the whole startup sequence, and we should probably clean that up instead of adjusting the timeout.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timcharper I've figured it out: The ConnectionPoolSettings creation does a reverse DNS lookup which is really slow on my macbook, which triggered the timeout. I've added a timeout check there and throw a reasonable error message now, so users of the lib will see something useful.

Tim Harper and others added 2 commits October 31, 2019 18:34
If we need timeouts they should be controlled by USI specific config,
and not by changing Akka defaults. Doing the latter could lead to
surprising behavior in frameworks that use Akka.

Further, the override order for reference.conf files is
non-deterministic. Depending on the packaging method used, one
reference.conf file (from akka) could take precendence over another, and
lead to non-deterministic config.

Avoid.
Copy link
Contributor

@timcharper timcharper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make the timeout configurable for the reverse-DNS lookup. Also, let's consider a function which takes Future[Flow[I, O, M]] and returns Flow[I, O, M]

Copy link
Contributor

@jeschkies jeschkies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move the DNS lookup timeout into a different pull request? DCOS_OSS-5633 is solved by shutting down the Akka Actor system. That is all that was required. This seems to be some scope creep to me.

@@ -52,6 +54,28 @@ case class Session(url: URL, streamId: String, authorization: Option[Credentials
Flow[Array[Byte]].map(createPostRequest(_, None)).via(connection)
}

private def poolSettings():Future[ConnectionPoolSettings] = Future {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for this being a future?

// dns lookup, which may take more than 5 seconds which triggers the akka streams subscription timeout.
// If we let the creation here take the full time, we won't start without any reasonable logging message
try {
Await.result(poolSettings(), 2.seconds)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get this. I'm sorry. Why can we not document the fact that apps should increase the Akka stream subscription timeout? It feels we are just introducing complexity here.

@DominikDary
Copy link

This PR is still relevant, right?

@jeschkies
Copy link
Contributor

@DominikDary, yes. @timcharper or me should take this over.

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

Successfully merging this pull request may close these issues.

4 participants