rubenlagus / TelegramBots

Java library to create bots using Telegram Bots API
https://telegram.me/JavaBotsApi
MIT License
4.68k stars 1.18k forks source link

After 4 messages bot stop receiving/sending #4

Closed pittersnider closed 8 years ago

pittersnider commented 8 years ago

After 3~4 messages, bot stop responding (i'm created a debug for receiving-sending messages) and don't receive more messages.

maratische commented 8 years ago

Same problem

Clevero commented 8 years ago

do you have used polling (getUpdates) or webhook for receiving messages?

maratische commented 8 years ago

simple pooling I think some problem with network and after app can not reconnect? I have added many logging in UpdatesThread.java and restart service... waiting... :)

Clevero commented 8 years ago

I will try to reproduce it in the following days

rubenlagus commented 8 years ago

Not sure what can be happening, my bots have been running for a month at least without problem. Can you provide some error or more information ?

maratische commented 8 years ago

I found problem. it was in line response = httpclient.execute(httpPost);

Apache http client some time hang on long request

I created two bots. 1 buit from your master source code and 2 built from my code with fix. 5 days on small nettop (Atom processor, linux, java8). 1 - regular hang 2 - stable work

https://github.com/maratische/TelegramBots/commit/b795c33d9074d4510e1e1098800c3e8916ff5416