rubenlagus / TelegramApi

Java library to create Telegram Clients
MIT License
300 stars 108 forks source link

Fix File Handle Leakage Bug #65

Open talebipour opened 6 years ago

talebipour commented 6 years ago

Bug fix for https://github.com/rubenlagus/TelegramApi/issues/62

onixred commented 6 years ago

hi i often you accept an warn

""15:49:27.287 [Selector Thread] WARN  Telegram Bot - [MTPROTO] too more
""15:49:27.287 [Selector Thread] WARN  Telegram Bot - [MTPROTO] too more
""15:49:27.287 [Selector Thread] WARN  Telegram Bot - [MTPROTO] too more
""15:49:27.288 [Selector Thread] WARN  Telegram Bot - [MTPROTO] too more
""15:49:27.288 [Selector Thread] WARN  Telegram Bot - [MTPROTO] too more

and

Exception in thread "ConnectionFixerThread#740617450" java.lang.OutOfMemoryError: Java heap space
        at sun.nio.ch.EPollArrayWrapper.<init>(EPollArrayWrapper.java:120)
        at sun.nio.ch.EPollSelectorImpl.<init>(EPollSelectorImpl.java:69)
        at sun.nio.ch.EPollSelectorProvider.openSelector(EPollSelectorProvider.java:36)
        at java.nio.channels.Selector.open(Selector.java:227)
        at jawnae.pyronet.PyroSelector.<init>(PyroSelector.java:28)
        at org.telegram.mtproto.transport.TcpContext.<init>(TcpContext.java:59)
        at org.telegram.mtproto.MTProto$ConnectionFixerThread.run(MTProto.java:795)
Exception in thread "Selector Thread" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Scheduller#427854241" java.lang.OutOfMemoryError: Java heap space
        at java.util.HashSet.<init>(HashSet.java:105)
        at org.telegram.mtproto.schedule.Scheduller$SchedullerPackage.<init>(Scheduller.java:598)
        at org.telegram.mtproto.schedule.Scheduller.postMessageDelayed(Scheduller.java:111)
        at org.telegram.mtproto.MTProto.internalSchedule(MTProto.java:488)
        at org.telegram.mtproto.MTProto.access$800(MTProto.java:45)
        at org.telegram.mtproto.MTProto$SchedullerThread.run(MTProto.java:674)
java.lang.OutOfMemoryError: Java heap space
Exception in thread "Selector Thread" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Selector Thread" java.lang.OutOfMemoryError: Java heap space

I think this is due to a memory leak

onixred commented 6 years ago

your fix does not solve the problem