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

ERROR: SSL_write, code: 336195711 #852

Closed
bdelfierro opened this issue Nov 15, 2016 · 9 comments
Closed

ERROR: SSL_write, code: 336195711 #852

bdelfierro opened this issue Nov 15, 2016 · 9 comments
Assignees
Milestone

Comments

@bdelfierro
Copy link

Hi,

I/m encountering this error when I enable TLS in linux 14.04
I'm using swift 3.0.1 and kitura 1.1.2
It's working if TLS is disabled.

VERBOSE: run() Kitura.swift line 71 - Starting Kitura framework...
VERBOSE: run() Kitura.swift line 73 - Starting an HTTP Server on port 8090...
INFO: listen(on:) HTTPServer.swift line 70 - Listening on port 8090 (delegate: SSLService.SSLService)
WARNING: init() ContentType.swift line 44 - Loading embedded MIME types.
ERROR: handleWriteHelper() IncomingSocketHandler.swift line 194 - Write to socket (file descriptor 7) failed. Error = Error code: 336195711, ERROR: SSL_write, code: 336195711, reason: bad write retry.

code:
let myCertPath = "/opt/phoenix/config/certificate.pem"
let myKeyPath = "/opt/phoenix/config/key.pem"

let mySSLConfig = SSLConfig(withCACertificateFilePath: nil, usingCertificateFile: myCertPath, withKeyFile: myKeyPath, usingSelfSignedCerts: true)

Kitura.addHTTPServer(onPort: 8090, with: router, withSSL: mySSLConfig)

@billabt
Copy link

billabt commented Nov 15, 2016

Fixed in BlueSSLService v0.11.56. Refreshing your dependencies should get the fix.

@bdelfierro
Copy link
Author

BlueSSLService is now in v0.11.56 but still the same error

ERROR: handleWriteHelper() IncomingSocketHandler.swift line 194 - Write to socket (file descriptor 7) failed. Error = Error code: 336195711, ERROR: SSL_write, code: 336195711, reason: bad write retry.

@billabt
Copy link

billabt commented Nov 16, 2016

I ran the exact same test here before posting the fix and I can't reproduce it. The only difference was I was using my certificates and running on Ubuntu 16.04. Can you provide a bit more information? What request triggered the error? Or did the error appear immediately? If it appeared immediately, it's likely a problem with your certs. Any more information you can provide would be extremely helpful. Thanks in advance.

@billabt
Copy link

billabt commented Nov 16, 2016

Been doing more research into this problem. Turns out the fix I put in is good but only for non-blocking sockets. I need to make some more changes.

@billabt
Copy link

billabt commented Nov 16, 2016

The complete fix for this is now in. However, it resulted in a version change for BlueSSLService and BlueSocket. Kitura-net depends on these and will need an update to Package.swift before the changes will be picked up by Kitura. I've tested the changes here (again on 16.04) and can not reproduce your problem. I'd still like to get more information from you regarding what triggered the error. Thanks.

@shmuelk shmuelk added this to the 1.2.0 milestone Nov 17, 2016
@shmuelk
Copy link
Collaborator

shmuelk commented Nov 17, 2016

Fixed as part of #858 per @billabt.

@foldericon
Copy link

I'm still having this issue with latest Kitura 1.6.1. However it seems like it only happens when I try to request content over the static file server that is more than 100KB (like bootstrap.min.css). Hope that helps.

@na-gupta
Copy link
Contributor

@foldericon This looks to be the same issue as #1036
I've submitted a pull request (Kitura/BlueSSLService#21) to BlueSSLService to fix the issue. Please let us know if this resolves the issue. Thanks!

@na-gupta na-gupta self-assigned this Mar 21, 2017
@na-gupta na-gupta reopened this Mar 21, 2017
@na-gupta na-gupta modified the milestones: 2017.06, 1.2.0 Mar 21, 2017
@na-gupta
Copy link
Contributor

@foldericon This has been fixed in SSLService-0.12.29. Please verify it works ok now by deleting your Packages directory and fetching/building again. Thanks!

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

No branches or pull requests

6 participants