ValvePython / steam

☁️ Python package for interacting with Steam
http://steam.readthedocs.io
MIT License
1.1k stars 137 forks source link

program stuck #387

Closed Ebispongebob closed 2 years ago

Ebispongebob commented 2 years ago

version: 1.2.0 python 2.7.6 when I use this module run a few days, anything is ok. but the program will stuck a time, and I can not use my timeout decorator to exit and restart it, I can only kill it and restart the program

lastest log:
2022-05-18 11:07:34.680 [PID:161728] CMServerList cm.py[line:491] ERROR WebAPI boostrap failed: HTTPSConnectionPool(host='api.steampowered.com', port=443): Max retries exceeded with url: /ISteamDirectory/GetCMList/v1/?format=json&cellid=0 (Caused by ProxyError('Cannot connect to proxy.', timeout('timed out',)))
my timeout decorator:
def set_timeout(num, callback=None):
    def wrap(func):
        def handle(signum, frame):
            raise TimeOutException
        def to_do(*args, **kwargs):
            try:
                signal.signal(signal.SIGALRM, handle)
                signal.alarm(num)
                r = func(*args, **kwargs)
                signal.alarm(0)
                return r
            except TimeOutException as e:
                if not callback:
                    raise TimeOutException
                else:
                    callback()
        return to_do
    return wrap

I think it might be related to the inability of signal to handle socket.getaddrinfo thanks for any help or suggestion