473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

How do clients(web browser) close a python CGI program that is not responding?

Hi,there. Sometimes a python CGI script tries to output great
quantities of HTML responce or in other cases, it just falls into a
dead loop. How could my client close that CGI script running on the
server? I tried to use the STOP button in the web browser button, but
it does not work.

In addition, how could I configure that if a CGI program do not finish
its task in 20sec or so, it will be automatically terminated?

Mar 28 '06 #1
3 2579
Sullivan WxPyQtKinter wrote:
Hi,there. Sometimes a python CGI script tries to output great
quantities of HTML responce or in other cases, it just falls into a
dead loop. How could my client close that CGI script running on the
server?
Generally speaking, remote users don't have control over your local
processes, and if there is some problem with that local process that
causes it to loop indefinitely, the chance that it could react
appropriately to the browser is slim anyway. So the answer is to fix
the problem with the CGI program.
In addition, how could I configure that if a CGI program do not finish
its task in 20sec or so, it will be automatically terminated?


I suppose you could run it in a background thread or process,
terminating it after the allotted time has expired, but I suspect you'd
be better off addressing whatever is causing the problem in the first
place. What sort of CGI program is this?

--
Ben Sizer

Mar 28 '06 #2
In article <11*********************@z34g2000cwc.googlegroups. com>, Sullivan WxPyQtKinter wrote:
Hi,there. Sometimes a python CGI script tries to output great
quantities of HTML responce or in other cases, it just falls into a
dead loop. How could my client close that CGI script running on the
server? I tried to use the STOP button in the web browser button, but
it does not work.
It depends on what CGI framework you're using. If the user hits
'stop', the client browser should close its connection and your web
server should close the pipe to your CGI process. I'd expect you to
get a SIGPIPE when next trying to output data.
In addition, how could I configure that if a CGI program do not finish
its task in 20sec or so, it will be automatically terminated?


Do you mean a specific CGI, or all CGIs in general? If it's in general
then you need to see if your web server can be configured to do that.
If it's a specific CGI, check out signal.alarm() or
resource.setrlimit(resource.RLIMIT_CPU, ...). Apache has a RLimitCPU
directive, but be careful with it since it may well not do what you
expect.
Mar 28 '06 #3
Actually my project is converting certain specially costomized XML
file to HTML to display and edit. Sometimes the XML file is too big, or
the client upload a very huge file for the server to process, which
exceeds the processing ability of my server.(after all, it is a small
server on my poor laptop....which use winXP and IIS......not
professional, huh?)

I configures IIS to terminate CGI program if it do not complete in 20
sec. But it does not work....Perhaps I should go to a IIS or apache
forum for answer.

Thank you.

Mar 28 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Marc | last post by:
Hello, i'm having a problem while downloading files on my server. When someone downloads a file ( push ) from the website, the system refuses to continue browsing while the download is going...
8
by: Yatharth | last post by:
Hi, I m new to threading and i have successfully runed threading but i could display value on my web page ,but its working in code behind when i see it through debugger,plzzzzzzz help me here...
1
by: trevor oakley | last post by:
I have solved an earlier problem which I posted here, about coding Data Source in OleDbConnection - I am new to ASP.Net. I do not understand the solution, I just blindly followed the book (Teach...
0
by: Michael Bredbury | last post by:
I am developing using Visual Studio .NET 2002 using ASP.NET and VB.NET. This is a web-based project which needs to install various ActiveX components on the users PC. ActiveX is needed because the...
2
by: Sam-Kiwi | last post by:
I've spent the last 6 months developing a pay-per-download website using ASP.NET Users purchase documents and then download them. The intention is that users are only charged for documents...
3
by: Jeffery Franzen | last post by:
Anyone know where the documentation is regarding Activex controls in asp web forms? I'm using VS.NET 2002 enterprise and am trying to use Activex controls in vb.net web form app. I do the add...
7
by: thisis | last post by:
Hi All, myGetImage.asp is suppose to create a temporary file in the client side, and display in on the client web browser. myGetImage.asp needs to know the clients web browser temporary...
3
by: Smith | last post by:
Hello, I need to stream data from a "DataTable" to the client's machine. The data first need to be converted to .CSV , and ziped before streaming it to the client. Does anyone has any...
1
by: amolbehl | last post by:
Hi I have to create a php or javascript that will be called from the main page of a website and it has to recognize the clients browser which opens that webpage and send me an email ... the email...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.