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
startup timeout will be ignored when enabling functionsWorkerEnabled in pulsar container #5252
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, great find 👍
I added some comments regarding how I think we can simplify the implementation.
public PulsarContainer withFunctionsWorker() { | ||
functionsWorkerEnabled = true; | ||
return this; | ||
} | ||
|
||
private WaitStrategy createLogWaitingStrategy() { | ||
if (startupTimeout != null) { | ||
return Wait.forLogMessage(".*Function worker service started.*", 1).withStartupTimeout(startupTimeout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can apply the startupTimeout
to the WaitAllStrategy
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
waitingFor( | ||
new WaitAllStrategy() | ||
.withStrategy(waitStrategy) | ||
.withStrategy(Wait.forLogMessage(".*Function worker service started.*", 1)) | ||
.withStrategy(createLogWaitingStrategy()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If instead of conditionally switching to the WaitAllStrategy
we would just use a WaitAllStrategy
as default and conditionally add the LogMessageWaitStrategy
to it, it should simplify the implementation (no need for overriding withStartupTimeout
anymore).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kiview i don't know what i should do here. :( Can you explain that a little more? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking something like this in the constructor:
waitingFor(
new WaitAllStrategy()
.withStrategy(Wait.forHttp(METRICS_ENDPOINT).forStatusCode(200).forPort(BROKER_HTTP_PORT))
);
And this in configure:
waitingFor(
new WaitAllStrategy()
.withStrategy(waitStrategy)
.withStrategy(Wait.forLogMessage(".*Function worker service started.*", 1)
// NOTE withStartupTimeout must be called at the end, because start timeout will be
// applied to all strategies above
.withStartupTimeout(startupTimeout))
);
But think somewhere along with the commits in this PR, we broke the shouldWaitForFunctionsWorkerStarted
test. It fails on CI and locally now. Maybe I gave a wrong suggestion, we have to look into this.
When using
120 seconds will be used as waiting strategy timeout. See logs:
/pensive_antonelli: Waiting for 120 seconds for URL: http://localhost:54554/metrics
But when using
startup timeout will be set to default (30 seconds). See logs:
/jolly_cerf: Waiting for 30 seconds for URL: http://localhost:54640/metrics
This is because when enabling functions worker a new log waiting strategy will be used. This fix will cache startup timeout and add (if exists) this to log waiting strategy.