opengsq / opengsq-python

Python library designed for querying game servers. It supports 24 different query protocols and has been downloaded over 34,000 times.
https://python.opengsq.com/
MIT License
24 stars 3 forks source link

Timeout error for no apparent reason. #14

Open SwozyWozy opened 6 months ago

SwozyWozy commented 6 months ago
import asyncio
from dotenv import load_dotenv
import os
from opengsq.protocols import Source

load_dotenv()

async def main():
    source = Source(host=os.getenv("HOST_IP"), port=os.getenv("QUERY_PORT"))
    info = await source.get_info()
    print(info)

asyncio.run(main())

I keep getting timeout error for no reason, no matter what server. Tested on 4 machines with same results.

SwozyWozy commented 6 months ago

After 3 days of constant timeout errors for no reason, just now it decided to work again with no changes to the code or environment. I also want to add that querying the server worked fine when using JS. The JS script was tested on 3 machines to make sure and worked fine on all 3.

BattlefieldDuck commented 6 months ago

Is the issue being resolved?

SwozyWozy commented 6 months ago

It's very inconsistent. It is no longer constantly timing out, but it will randomly stop working, and take anywhere between 1–5 tries to get a response.

BattlefieldDuck commented 6 months ago

This might be the problem of rate limiting issue. Your game server or firewall might rate-limit the query. You might need to whitelist the query server IP.

SwozyWozy commented 6 months ago

I doubt that because it works fine in JS and online query websites. And I'm not querying the server that often.

BattlefieldDuck commented 6 months ago

Can you please provide more info, like game server IP, and port if possible thanks.

SwozyWozy commented 6 months ago

176.57.168.179:29015

SwozyWozy commented 6 months ago

image the server gets queried every 10 seconds.

BattlefieldDuck commented 6 months ago

Your server is unreachable sometimes.

image

The issue is either your server internet is unstable or the firewall rule is too strict.

SwozyWozy commented 6 months ago

How come when I query it in JS using gamedig and use a website like https://cmsminecraftshop.com/en/query/ it works fine? Do you know how I can fix this?

BattlefieldDuck commented 6 months ago

It is based on how your game server's internet is set up, it is hard to have an easy solution for that.

SwozyWozy commented 6 months ago

Alright, well, thank you for looking into it. I will keep looking for a fix.