能够 ping 但在运行我的 python 程序几个小时后无法浏览

发布于 2024-10-11 19:47:17 字数 358 浏览 4 评论 0原文

这是我用Python编写的一个GUI程序,用于检查在我的XP SP3上运行的网站/服务器状态,多线程用于检查不同的站点/服务器。运行几个小时后,程序开始一直出现 urlopen 超时错误,这种情况总是在服务器(不是某个服务器,可能是 A、B 或 C)发出 POST 请求后发生,而且也不是第一个 POST 请求导致问题,通常在运行几个小时后,碰巧在未知时刻发出 POST 请求,从那时起您得到的只是 urlopen 错误超时。

我仍然可以 ping 通,但无法浏览任何网站,程序关闭后一切正常。这绝对是导致这个问题的程序,好吧,我只是不知道如何调试/检查问题是什么,也不知道它是来自操作系统端还是我的程序浪费了太多资源/连接(您仍然能够当使用太多连接时 ping?),有人可以帮助我吗?

It's a GUI program I wrote in python checking website/server status running on my XP SP3, multi threads are used to check different site/server. After several hours running, the program starts to get urlopen error timed out all the time, and this always happens right after a POST request from a server(not a certain one, might be A or B or C), and it's also not the first POST request causing the problem, normally after several hours running and it happens to make a POST request at an unknown moment, all you get from then on is urlopen error timed out.

I'm still able to ping but cannot browse any site, once the program closed everything's fine. It's definitely the program causing this problem, well I just don't know how to debug/check what the problem is, also don't know if it's from OS side or my program wasting too many resources/connections(are you still able to ping when too many connections used?), would anybody please help me out?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烟花易冷人易散 2024-10-18 19:47:17

您确定在每次请求后关闭 TCP 会话吗?尝试时不时地检查 netstat 信息,如果您发现活动/已建立会话的数量正在上升,则意味着您的脚本中存在一些问题。

是的,通常即使您没有可用的 TCP 套接字,也可以 ping 通。

Are you sure you are closing TCP sessions after each request? Try to check netstat information from time to time and if you'll see that the number of active/established sessions is rising it means that you have some problems in your script.

Yes, usually you can ping even if you are out of free TCP sockets.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文