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

VPN is unable to recover from ENOBUFS #104

Closed
keeshux opened this issue Jun 21, 2019 · 3 comments

Comments

@keeshux
Copy link
Member

commented Jun 21, 2019

Summary

"No buffer space available" errors are silently ignored. The socket stays broken and the VPN only works after reconnecting manually.

Steps to reproduce

Do an upload speedtest on 4G on a decently old device (iPhone 6s Plus here).

What is the current bug behavior?

Broken connectivity until manual reconnection.

What is the expected correct behavior?

Automatic reconnection.

Relevant logs and/or screenshots

17:24:03 - Failed LINK read: Error Domain=NSPOSIXErrorDomain Code=55 "No buffer space available"
17:24:04 - Failed LINK read: Error Domain=NSPOSIXErrorDomain Code=55 "No buffer space available"
17:24:04 - Failed LINK read: Error Domain=NSPOSIXErrorDomain Code=55 "No buffer space available"
...

Possible fixes suggested remediation

Introduced in an attempt to fix #87

@keeshux keeshux added the bug label Jun 21, 2019
@keeshux keeshux added this to the 1.7.2 milestone Jun 21, 2019
@keeshux keeshux self-assigned this Jun 21, 2019
keeshux added a commit that referenced this issue Jul 8, 2019
Fixes #104
@keeshux keeshux changed the title VPN is unable to reconnect on ENOBUFS VPN is unable to recover from ENOBUFS Jul 9, 2019
@keeshux

This comment has been minimized.

Copy link
Member Author

commented Jul 9, 2019

From https://developer.apple.com/documentation/networkextension/nwudpsession/1406390-writemultipledatagrams

Callers should wait until the completionHandler is executed before issuing another write.

@keeshux

This comment has been minimized.

Copy link
Member Author

commented Jul 13, 2019

It looks like ENOBUFS triggers on any attempt of writeMultipleDatagrams to send about 20kb or more at once.

keeshux added a commit that referenced this issue Jul 26, 2019
Do not coalesce calls to .writeDatagrams as per Apple
recommendations.

> Callers should wait until the completionHandler is executed before
issuing another write.

Fixes #104
keeshux added a commit that referenced this issue Jul 26, 2019
Do not coalesce calls to .writeDatagrams as per Apple
recommendations.

> Callers should wait until the completionHandler is executed before
issuing another write.

Fixes #104
keeshux added a commit that referenced this issue Jul 26, 2019
Do not coalesce calls to .writeDatagrams as per Apple
recommendations.

> Callers should wait until the completionHandler is executed before
issuing another write.

Fixes #104
@keeshux

This comment has been minimized.

Copy link
Member Author

commented Jul 26, 2019

The code should avoid this situation by queueing writes to a certain extent. However, when the error happens, disconnect and recover.

keeshux added a commit that referenced this issue Jul 26, 2019
Do not coalesce calls to .writeDatagrams as per Apple
recommendations.

> Callers should wait until the completionHandler is executed before
issuing another write.

Fixes #104
@keeshux keeshux closed this in 3577674 Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.