xtrime-ru / TelegramApiServer

Fast, simple, async php telegram api server: MadelineProto + Amp HTTP Server
https://tg.i-c-a.su
MIT License
531 stars 119 forks source link

Session not confirmed cause restart docker container #58

Open Maverick1983 opened 3 years ago

Maverick1983 commented 3 years ago

I test add session without confirm with Telegram's code.

Docker container crash and restarted always. This is the error

`Number of sessions: 2. Authorizing session: users/rob Do you want to login as user or bot (u/b)? Enter your phone number: Fatal error: Uncaught Error: Resource has already been freed in /app-host-link/vendor/amphp/byte-stream/lib/ResourceInputStream.php:250 Stack trace:

0 /app-host-link/vendor/danog/madelineproto/src/danog/MadelineProto/Magic.php(420): Amp\ByteStream\ResourceInputStream->unreference()

1 /app-host-link/vendor/danog/madelineproto/src/danog/MadelineProto/Exception.php(102): danog\MadelineProto\Magic::shutdown(1)

2 [internal function]: danog\MadelineProto\Exception::exceptionHandler(Object(danog\MadelineProto\RPCErrorException))

3 {main}

thrown in /app-host-link/vendor/amphp/byte-stream/lib/ResourceInputStream.php on line 250

Fatal error: Uncaught Error: Resource has already been freed in /app-host-link/vendor/amphp/byte-stream/lib/ResourceInputStream.php:250 Stack trace:

0 /app-host-link/vendor/danog/madelineproto/src/danog/MadelineProto/Magic.php(420): Amp\ByteStream\ResourceInputStream->unreference()

1 /app-host-link/vendor/danog/madelineproto/src/danog/MadelineProto/Shutdown.php(55): danog\MadelineProto\Magic::shutdown(0)

2 [internal function]: danog\MadelineProto\Shutdown::shutdown()

3 {main}

thrown in /app-host-link/vendor/amphp/byte-stream/lib/ResourceInputStream.php on line 250`

xtrime-ru commented 3 years ago

Hi! If you have invalid session, you can just remove its files from /session folder.

Maverick1983 commented 3 years ago

How I can check for invalid sessions?

Il Lun 1 Mar 2021, 00:10 Alexander Pankratov notifications@github.com ha scritto:

Hi! If you have invalid session, you can just remove its files from /session folder.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xtrime-ru/TelegramApiServer/issues/58#issuecomment-787542319, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE43GZUQUKNEXMCXXLPPC4DTBLEQBANCNFSM4YLIJW5A .

xtrime-ru commented 3 years ago

How I can check for invalid sessions?

If error occures right after this message, than this is invalid session:

Authorizing session: users/rob

Maverick1983 commented 3 years ago

But there is nothing to check it automatically? I see logs on Docker because container restart always...

Il giorno lun 1 mar 2021 alle ore 21:59 Alexander Pankratov < notifications@github.com> ha scritto:

How I can check for invalid sessions?

If error occures right after this message, than this is invalid session:

Authorizing session: users/rob

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xtrime-ru/TelegramApiServer/issues/58#issuecomment-788275842, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE43GZQZF2KKVT6DALXA6CDTBP5ZXANCNFSM4YLIJW5A .

xtrime-ru commented 3 years ago

Telegram client (madelineProto) don't have any tools to validate sessions. So only way to check it - try to start. In case of any fatal errors container will restart.

Only way to fix corrupted session is to recreate it.

Are you able to create valid session, or all your sessions become invalid?

xtrime-ru commented 3 years ago

Corrupted session is very rare case. My sessions works fine for over 3 years. So validation tool has very limited apply.

Maverick1983 commented 3 years ago

I created good session. One session not confirm with Telegram code, cause restart loop

Il Lun 1 Mar 2021, 22:52 Alexander Pankratov notifications@github.com ha scritto:

Telegram client dont have any tools to validate sessions. So only way to check it - try to start. In case of any fatal errors container will restart.

Only way to fix corrupted session is to recreate it.

Are you able to create valid session, or all your sessions become invalid?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xtrime-ru/TelegramApiServer/issues/58#issuecomment-788323932, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE43GZS66DVC73ZR6TIH6FTTBQEATANCNFSM4YLIJW5A .

Maverick1983 commented 3 years ago

Corrupted session is very rare case. My sessions works fine for over 3 years. So validation tool has very limited apply.

The problem was after login and never send validation code or delete session from app.