HTTP connections fail under Windows subsystem for Linux

Bug #1614688 reported by Alex Oughton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
keystoneauth
Fix Released
Medium
Alex Oughton

Bug Description

Hello,

HTTP connections are failing when running under Windows subsystem for Linux:
ERROR (ConnectFailure): Unable to establish connection to https://******:5000/v2.0/tokens

Through strace, I established that this was failing when TCP_KEEPCNT was being set to 4:
setsockopt(3, SOL_TCP, TCP_KEEPCNT, [4], 4) = -1 EINVAL (Invalid argument)

This is being caused by the TCPKeepAliveAdapter class in session.py which sets various parameters in order to disable Nagle's algorithm. The Windows Subsystem for Linux is not yet a complete implementation of Linux APIs, and overriding TCP_KEEPCNT doesn't appear to have been implemented yet. This is why the "Invalid argument" error is occurring.

The error can be avoided by simply checking if we're running under WSL, and skipping the TCP_KEEPCNT change if so.

Old check:
if hasattr(socket, 'TCP_KEEPCNT'):

New check:
if hasattr(socket, 'TCP_KEEPCNT') and not (os.path.isfile('/proc/version') and 'Microsoft' in open('/proc/version').read()):

I'll be submitting a patch shortly.

Thanks,

Alex Oughton

Changed in keystoneauth:
assignee: nobody → Alex Oughton (alex-oughton)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystoneauth (master)

Fix proposed to branch: master
Review: https://review.openstack.org/357452

Changed in keystoneauth:
status: New → In Progress
Changed in keystoneauth:
assignee: Alex Oughton (alex-oughton) → Steve Martinelli (stevemar)
Changed in keystoneauth:
importance: Undecided → Medium
assignee: Steve Martinelli (stevemar) → Alex Oughton (alex-oughton)
Changed in keystoneauth:
assignee: Alex Oughton (alex-oughton) → Samuel de Medeiros Queiroz (samueldmq)
Changed in keystoneauth:
assignee: Samuel de Medeiros Queiroz (samueldmq) → Alex Oughton (alex-oughton)
Changed in keystoneauth:
assignee: Alex Oughton (alex-oughton) → Steve Martinelli (stevemar)
Changed in keystoneauth:
assignee: Steve Martinelli (stevemar) → Alex Oughton (alex-oughton)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystoneauth (master)

Reviewed: https://review.openstack.org/357452
Committed: https://git.openstack.org/cgit/openstack/keystoneauth/commit/?id=e3009ab365203b63174251d5f5c2f90f64fd395e
Submitter: Jenkins
Branch: master

commit e3009ab365203b63174251d5f5c2f90f64fd395e
Author: Alex Oughton <email address hidden>
Date: Thu Aug 18 15:20:40 2016 -0500

    Disables TCP_KEEPCNT when using Windows Subsystem for Linux

    The Windows Subsystem for Linux is not a complete implementation
    of the Linux APIs, and setting TCP_KEEPCNT is currently
    unimplmenented. Attempting to use this option will cause HTTP
    connections to fail. This change checks if we are running under
    WSL, and disables changing TCP_KEEPCNT parameters if so.

    Change-Id: Ic8b41dea2a75660d9adbce88a00a0fe703a4d120
    Closes-Bug: #1614688

Changed in keystoneauth:
status: In Progress → Fix Released
Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote : Fix included in openstack/keystoneauth 2.12.0

This issue was fixed in the openstack/keystoneauth 2.12.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.