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

auth.ExportAuthorization Floodwait #108

Open
pdisk opened this issue Apr 24, 2023 · 11 comments
Open

auth.ExportAuthorization Floodwait #108

pdisk opened this issue Apr 24, 2023 · 11 comments
Labels
inspecting Currently looking into this issue

Comments

@pdisk
Copy link

pdisk commented Apr 24, 2023

is this error cuz bot gets restarted every time it reaches 900 mb ram usage (takes only abt 3 minute)
or cuz when bot gets restarted all files need to fetched from telegram again?
or any other reason

i made the code use session file to persist session even when bot is restarted idk what the issue is
please let me know whats causing this or how to fix this

(idk how to write a proper issue sorry 🤓)

@EverythingSuckz
Copy link
Owner

@pdisk This error might be due to too many users using your server, I highly advice you to use multi client feature to reduce the load of the server. And about the RAM usage, Try setting the USE_SESSION_FILE var to True to use a storage file rather than saving the session files in memory which consumes more RAM. If you still have issues, please attach the logs as a pastebin link next time.

@pdisk
Copy link
Author

pdisk commented Apr 25, 2023

@EverythingSuckz Yes I already use it with multi_client mode with 10 bots in total and USE_SESSION_FILE var Has Already been set to True, i think it should work without this error if the program isn't restarting cuz of ram usage
when the program restarts even with session file the bots are made to get all media session again at once which may be the reason for this floodwait (just my assumption). If that was the case then shouldn't the bot be taking the media sessions from session file instead of getting new fresh ones all at once?

Error: https://pastebin.com/Nw8PJECf

@EverythingSuckz
Copy link
Owner

@EverythingSuckz Yes I already use it with multi_client mode with 10 bots in total and USE_SESSION_FILE var Has Already been set to True, i think it should work without this error if the program isn't restarting cuz of ram usage when the program restarts even with session file the bots are made to get all media session again at once which may be the reason for this floodwait (just my assumption). If that was the case then shouldn't the bot be taking the media sessions from session file instead of getting new fresh ones all at once?

Error: https://pastebin.com/Nw8PJECf

Not sure about the fact whether pyrogram tried to get media sessions on startup. Like, there are only 5 Telegram DC IDs and we only need 5 media sessions per bot. I don't really understand why Telegram gives floodwait for that even tho media session is being cached and even if it's not cached, it only makes like 5 request at max. Looks like I need to check this issue.
Also about the ram usages, normally it won't take much ram when you use a session file btw. Seems like there might be something that's eating up the memory.

@EverythingSuckz EverythingSuckz added the inspecting Currently looking into this issue label Apr 25, 2023
@HydroHax
Copy link

😶

@pdisk
Copy link
Author

pdisk commented Apr 25, 2023

@EverythingSuckz This error doesn't stop the program and instead the error is shown every time a file is taken, are there any work around u can suggest to temporarily solve the issue

or if any suggestions to pin point the error, I'll send more logs and findings

(i had to modify the code to take files from multiple channels by passing the channel id along with messageid and had to remove the hash checking part for it) still i don't think that can cause this FloodWait

@EverythingSuckz
Copy link
Owner

EverythingSuckz commented Apr 25, 2023

@EverythingSuckz This error doesn't stop the program and instead the error is shown every time a file is taken, are there any work around u can suggest to temporarily solve the issue

or if any suggestions to pin point the error, I'll send more logs and findings

(i had to modify the code to take files from multiple channels by passing the channel id along with messageid and had to remove the hash checking part for it) still i don't think that can cause this FloodWait

So you've modified it? Well then I can't really make sure about the bug since I've hosted the bot with 20 clients and there were no such issues. Maybe provide more logs?

@pdisk
Copy link
Author

pdisk commented Apr 25, 2023

i fixed the issue with asyncio.Lock()

when server was restarted all the request came at once making the script to generate_media_session multiple times before checking if the function has already been executed with a lock for each bot and each dcid i was able to solve the issue

@pdisk
Copy link
Author

pdisk commented Apr 25, 2023

@EverythingSuckz i Still Couldn't Figure out what's causing the intense ram usage tho
with 10 bots each with work load of 15 (150 in total) at maximux load the ram usage goes up like there is no tomorrow
its not an issue with my modification as i only changed the part of url to get chatid with messageid

no other variables or functions has been written as mod

without even a single error the ram usage spike to 1.2 or more if i allow it to

@EverythingSuckz
Copy link
Owner

i fixed the issue with asyncio.Lock()

when server was restarted all the request came at once making the script to generate_media_session multiple times before checking if the function has already been executed with a lock for each bot and each dcid i was able to solve the issue

Oh, if you think it's a major issue, then feel free to do a PR.

@EverythingSuckz
Copy link
Owner

@EverythingSuckz i Still Couldn't Figure out what's causing the intense ram usage tho with 10 bots each with work load of 15 (150 in total) at maximux load the ram usage goes up like there is no tomorrow its not an issue with my modification as i only changed the part of url to get chatid with messageid

no other variables or functions has been written as mod

without even a single error the ram usage spike to 1.2 or more if i allow it to

Seems like I'll have to profile the memory usage and see where exactly is this memory is being used.

1 similar comment
@EverythingSuckz
Copy link
Owner

@EverythingSuckz i Still Couldn't Figure out what's causing the intense ram usage tho with 10 bots each with work load of 15 (150 in total) at maximux load the ram usage goes up like there is no tomorrow its not an issue with my modification as i only changed the part of url to get chatid with messageid

no other variables or functions has been written as mod

without even a single error the ram usage spike to 1.2 or more if i allow it to

Seems like I'll have to profile the memory usage and see where exactly is this memory is being used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inspecting Currently looking into this issue
Projects
None yet
Development

No branches or pull requests

3 participants