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

Change gen_statem:call(_, _, {clean_timeout,infinity}) to use proxy #1595

Conversation

RaimoNiskanen
Copy link
Contributor

@RaimoNiskanen RaimoNiskanen commented Oct 6, 2017

I would like community feedback on a changing a corner case for timeouts in gen_statem:call(Server, Request, Timeout) for OTP 21.0.

The Timeout == {clean_timeout,infinity} today means {dirty_timeout,infinity} i.e does not use a proxy process. This was intended as an optimization.

But since in the event of network problems such as the connection going down and up the monitor set before sending Request may trigger causing the client call to fail, but the Request may actually have arrived at the server, which may reply so we get an unhandled late reply in the inbox. Very rarely.

I think that giving the programmer the possibility to use a proxy process even for infinity timeout simplifies the semantics and may be found useful.

The behaviour for Timeout == infinity will still mean {dirty_timeout,infinity} that is: no proxy process.

@RaimoNiskanen RaimoNiskanen self-assigned this Oct 6, 2017
@RaimoNiskanen RaimoNiskanen added fix team:MW team:PS Assigned to OTP team PS testing currently being tested, tag is used by OTP internal CI labels Oct 6, 2017
@ferd
Copy link
Contributor

ferd commented Oct 6, 2017

In the docs:

So why not just don't catch the exception and let the calling process die?

Should be "So why not just let the calling process die by not catching the exception?"


Otherwise I'm okay with things. If the default does not change, leaving some control to the caller makes sense at no requirements to change existing code. The complexity of the API is still quite large, but at that point, the local vs. proxy mechanism had already been exposed so this modification just makes it more consistent I think, by not messing with the explicit options given by the user.

I'd give a tentative +1 to this.

@RaimoNiskanen RaimoNiskanen force-pushed the raimo/stdlib/gen_statem-clean_timeout-infinity/OTP-13073 branch from 371848c to 8efef4a Compare October 9, 2017 08:00
@RaimoNiskanen
Copy link
Contributor Author

@ferd I made a mistake thinking messing with the explicit options given by the user would be an unobservable optimization. But I have learned and want to fix this in a 21.0.

I approve your rephrasing suggestion.

@RaimoNiskanen RaimoNiskanen merged commit 5c917e3 into erlang:master Oct 11, 2017
@RaimoNiskanen RaimoNiskanen deleted the raimo/stdlib/gen_statem-clean_timeout-infinity/OTP-13073 branch October 11, 2017 08:35
@RaimoNiskanen RaimoNiskanen removed the testing currently being tested, tag is used by OTP internal CI label Oct 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix team:PS Assigned to OTP team PS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants