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

Ubuntu problem (Linux) #9

Closed
dmasoft opened this issue Mar 17, 2014 · 22 comments
Closed

Ubuntu problem (Linux) #9

dmasoft opened this issue Mar 17, 2014 · 22 comments

Comments

@dmasoft
Copy link

dmasoft commented Mar 17, 2014

I think there is a problem with the JVM in linux. When I make a to any method of the API (TLRequestHelpGetConfig for example) I always get a timeOutException. But when I Try it on windows or mac, I get te correct answer. Does anyone know if there is any differences between de JVM??

@ex3ndr
Copy link
Collaborator

ex3ndr commented Mar 17, 2014

Api is tested for work on Mac OSX. But someone reported that he has timeouts. We need to collect more information.
But, api is not designed for non-unix systems and have never tested in windows.

@dmasoft
Copy link
Author

dmasoft commented Mar 17, 2014

I had tested on Windows and it works right. The problem is in linux (Ubuntu). Always returns a timeOutExceptions.

@Thus0
Copy link

Thus0 commented Mar 18, 2014

I also had timeout for the telegram-bot (I've only tested on linux/gentoo so far with jvm 1.6.0_45) so perhaps it's a duplicate bug of this one : telegram-s/telegram-bot#2

@floens
Copy link

floens commented Mar 18, 2014

I've been researching the TimeoutException bug for a while now. It appears only on Linux (Debian tested), and not on Windows/mac/freebsd.
I ran Wireshark on Windows and Linux to look for differences, and it looks like that on Linux the packages don't get send to the server after the initial connection. Wireshark shows packages getting send to the server, but on Linux it just... stops.
And after a while it gives a TimeoutException.
So I guess it's a jvm/linux bug.

@Thus0
Copy link

Thus0 commented Mar 18, 2014

thanks Floens for your feedback.

I've enabled logging to see where the timeout occurred. I need to look at the mt protocol to get more informations I think :)

'''
Use test DC? (write test for test servers): Using test servers
TelegramApi#1001:Phase 0 in 1 ms
TelegramApi#1001:Phase 1 in 86 ms
TelegramApi#1001:Timeout Iteration
TelegramApi#1001:Connection iteration
TelegramApi#1001:#1: waitForDc
TelegramApi#1001:#1: Creating proto for dc
TelegramApi#1001:#1: Creating key
TelegramApi#1001:Phase 2 in 3 ms
TelegramApi#1001:Sender iteration
api#1001#Downloader:DownloadFileThread iteration
api#1001#Downloader:DownloadFileThread iteration
api#1001#Downloader:DownloadFileThread iteration
api#1001#Downloader:DownloadFileThread iteration
api#1001#Uploader:UploadFileThread iteration
TelegramApi#1001:Phase 3 in 4 ms
api#1001#Uploader:UploadFileThread iteration
Loading fresh DC list...
api#1001#Uploader:UploadFileThread iteration
api#1001#Uploader:UploadFileThread iteration
TelegramApi#1001:Timeout Iteration
TelegramApi#1001:Sender iteration
TelegramApi#1001:>> #0: help.getConfig#c4f9186b
TransportRate:Transport: #1 173.240.5.253:443 #1.0
TransportRate:tryConnection #1
TransportRate:onConnectionSuccess #1
TransportRate:Transport: #1 173.240.5.253:443 #1.0
Authorizer:Solved PQ in 45 ms
TelegramApi#1001:Timeout Iteration
TelegramApi#1001:RPC #0: Timeout (14999 ms)
TelegramApi#1001:Timeout Iteration
org.telegram.api.engine.TimeoutException
completed.
'''

@dmasoft
Copy link
Author

dmasoft commented Mar 19, 2014

Well, The only new thing that I have discovered is that the API works in Solaris too.
I give up about the problem in the debian distribution. I think is a problem related with the JVM or the network configuration. I'm sure that will be fixed in next releases

@Thus0
Copy link

Thus0 commented Mar 19, 2014

I've tried Oracle 1.7 or sun 1.6 but same timeout issue

@floens
Copy link

floens commented Mar 20, 2014

This seems to fix it:
http://www.virtualzone.de/2011/10/javas-securerandomgenerateseed-on-linux.html

java -Djava.security.egd=file:/dev/./urandom -jar foo.jar

It's because java by default uses /dev/random which blocks.

@dmasoft
Copy link
Author

dmasoft commented Mar 20, 2014

You are right Floens, this solves the problem!!
Thanks!

@dmasoft dmasoft closed this as completed Mar 20, 2014
@Thus0
Copy link

Thus0 commented Mar 21, 2014

thanks for the fix 👍

I had to change /etc/java-6-openjdk/security/java.security and modify this line

securerandom.source=file:/dev/./urandom

@ashokcoolguys
Copy link

I m getting timeout while rpccall for importing contacts, in windows 64bit , jdk 1.7.

@cancerian0684
Copy link

It started working for me after I updated Server IP Address in the MemoryStateAPI class, as shown below -

 public void start(boolean isTest) {
        connections = new HashMap<>();
        connections.put(1, new ConnectionInfo[]{
                new ConnectionInfo(1, 0, isTest ? "149.154.175.10" : "149.154.175.50", 443)
        });
    }

@Raakh
Copy link

Raakh commented Sep 19, 2015

Can you please send me compiled working code to my email ghayel@gmail.com? I shall be grateful to you

@dcd99
Copy link

dcd99 commented Jan 10, 2016

Hi all,
have you finally found a solution to this problem?
could you be so kind to share a complete working code ?
Many thanks in advance for the support.

@vaibhavthapliyal
Copy link

Hi, I am facing this same issue when sending the auth.checkPhone request. However while sending the auth.sendCode request I was able to solve this problem by adding the java parameters as Floens mentioned. Anybody knows what's happening?

I am using CentOs 6.5 with eclipse luna and java 8

@floens
Copy link

floens commented Feb 15, 2016

@vaibhavthapliyal

It's because java by default uses /dev/random which blocks.

@vaibhavthapliyal
Copy link

Hi,

Thanks for the reply. But as I mentioned, I have already applied the runtime parameters that you have suggested and because of that the auth.sendCode was successfully made. But this new request auth.checkphone seems to fail with a TimedOutException.

Thanks
Vaibhav

@floens
Copy link

floens commented Feb 15, 2016

Ah. Well try to see with the debugger where the thread hangs (pause the jvm). This library is very old so you might want to look for another telegram solution.

@vaibhavthapliyal
Copy link

It seems that this is the only JAVA API library for working with the telegram API. I have recompiled this to work with Layer 18 API and was able to run the sendCode request. Were you able to get this done when you were working on it? Is there any other library that you found helpful?

@amalagaura
Copy link

This answer explains the issue if it is not related to /random

http://stackoverflow.com/a/33941544/234125

@vaibhavthapliyal
Copy link

Thanks for the link. I'm not sure what happened but the error disappeared by itself. Everything is working now.

@amalagaura
Copy link

I am continuing to have issues with this library. The author has moved on, so it is understandable.

But I stumbled across this library which is recently released: https://github.com/badoualy/kotlogram

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

10 participants