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

Tcp Socket seems to fails when sending (smtpclient) data larger then 16384 bytes #25

Closed
Stefano1964 opened this issue Dec 20, 2015 · 15 comments

Comments

@Stefano1964
Copy link

Hi, for first a big thanks to having developed such amazing class system to manage an email client.
I've built a complete email client with your emal.js class (no encryption).
Its' sencha touch + (browserbox, smtpclient, etc) + cordova app for iOS and Android.
It's working well, except that on the Android version it's failing (smtpclient.js client.send(data)) sending more then 16384 bytes, maybe related with this (not fixed): MobileChromeApps/cordova-plugin-chrome-apps-sockets-tcp@990b0ca
I got i timed out error from smtpclient
Any idea?

@Stefano1964 Stefano1964 changed the title Tcp Socket seems to fails when sending (smtpclient) data larger then 16384 byes Tcp Socket seems to fails when sending (smtpclient) data larger then 16384 byest Dec 20, 2015
@Stefano1964 Stefano1964 changed the title Tcp Socket seems to fails when sending (smtpclient) data larger then 16384 byest Tcp Socket seems to fails when sending (smtpclient) data larger then 16384 bytes Dec 20, 2015
@felixhammerl
Copy link
Contributor

can you provide some more info on the environment? i am fairly sure that the bug is not from the socket itself but rather from the smtpclient.
what smtp server are yout talking to? is this reproducible?

@Stefano1964
Copy link
Author

I'm testing with gmail account, with ssl, it's only an Android issue, it's working on iOS. I've tested with android 4.4.4, 5.1.1 and 6.01. with the last Cordova Android with Crosswalk plugin and the last Chrome cordova Plugin. Of course i'm using the last email.js library. If you need more info let me know.

@felixhammerl
Copy link
Contributor

damn ... an idea: could you debug what the socket actually does, and/or log the network activity? my guess is that the error is in here somewhere: https://github.com/whiteout-io/smtpclient/blob/master/src/smtpclient.js#L568-L589

@Stefano1964
Copy link
Author

I've just played with this trying to increase the timeout (TIMEOUT_SOCKET_MULTIPLIER from 01. to 1 or more) but with no luck, i've not played with TIMEOUT_SOCKET_LOWER_BOUND. I try to log network activity

@Stefano1964
Copy link
Author

For first, i've tried with another email provider, same result. It's working on iOS (zero problem), but it's not working on Android. So it's not a gmail issue. I've tried putting extra console message in smtpclient,
the timeout is always > 10000 (10sec) for succesful message sent (<16kb) and for unsucessful messages (>16kb), smtpclient in this case is hanging on send payload, it's not receiving response form server. I've some doubt is an smtpclient issue, the code (javascript) is same for iOS and Android, the difference is in the chrome socket plugin. What do you think?

@Stefano1964
Copy link
Author

I've tried your app whiteout mail on Android, same problem with messages > 16kb (text only, no attachment), not sending. Same gmail account that i've used for the other test.

@Stefano1964
Copy link
Author

Hi Felix, i'm pretty shure that's the problem is with ChromeSocketsTcp.java.
What happen is when i send a mailbody the smtpclient send 2 chunk, the first with the data and the second is a 3 bytes len (the terminator?). When the mailbody is larger than 16kb this callback:
if (recvBytes != null) {
JSONObject info = new JSONObject();
info.put("socketId", socketId);
sendReceiveEvent(new PluginResult(Status.OK, info));
sendReceiveEvent(new PluginResult(Status.OK, recvBytes));
Log.i("DEBUG", "DATA RETURN: " + recvBytes.length);
}
in ChromeSocketsTcp.java is never called (the log.i is mine), so smtpclient return the timeout

@Stefano1964
Copy link
Author

I forgot to mention that all the data sended from smtpclient are received by ChromeSocketsTcp.java and sended, i can suppose there is a timing problem in ChromeSocketsTcp.java.
Also there this one in setPipeToFileProperties function
uriOutputStream = webView.getResourceApi().openOutputStream(outputUri, append);
the webview in this case is the crosswalk webview...

@felixhammerl
Copy link
Contributor

nice observation! can you reference this issue in the cca project?

@Stefano1964
Copy link
Author

No way, tried without crosswalk plugin, same result. So it's not crosswalk..

@Stefano1964
Copy link
Author

I've opened an issue but no response till now:
MobileChromeApps/cordova-plugin-chrome-apps-sockets-tcp#9

@Stefano1964
Copy link
Author

Hi Felix, i've found the bug:
MobileChromeApps/cordova-plugin-chrome-apps-sockets-tcp#9

@felixhammerl
Copy link
Contributor

that's some seriously impressive debugging right there :)

@Stefano1964
Copy link
Author

Hi Felix, i've fixed it. Now it's working, i can send mailbody of some MB. I'll test a little more.
The bug is exactly the one i've posted on cca.

@felixhammerl
Copy link
Contributor

ok, seems like this issue can be closed

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

2 participants