473,769 Members | 1,672 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mod_python and open HTTP connection

Hello, I'm think about using mod_python for a project but I need to make
sure: Does mod_python time out after a minute ? (I hope not). If I leave
an HTTP connection open so that the content keeps loading inside the
browser window indefinately, and if I close the browser window, the
mod_python process is terminated, right?
Thanks,

--
Charles.

Desenvolvimento e criação de sites: www.auriance.com
Hospedagem de sites e servidores dedicados: www.auriance.net
Feb 16 '06 #1
3 2472

Charles wrote:
Hello, I'm think about using mod_python for a project but I need to make
sure: Does mod_python time out after a minute ? (I hope not).
Mod_python itself doesn't time out. If such a thing happened it
would be because of how Apache, some intermediate proxy or
the client is configured.
If I leave
an HTTP connection open so that the content keeps loading inside the
browser window indefinately, and if I close the browser window, the
mod_python process is terminated, right?


If the mod_python handler is periodically writing data back to the
browser, at the point the socket connection from the client closes,
the attempt to write data back to the client by the mod_python
handler will result in an IOError exception being raised. Presuming
that your handler code doesn't catch this and ignore it, it should
cause the handler to abort.

Note though that it doesn't cause any process to be terminated as
that is not how Apache/mod_python work. It will cause just that
current request to be terminated. That thread of control can then
be reused to handle a subsequent request.

BTW, for tricky questions on mod_python you are better of using
the mod_python mailing list. Details on the mod_python web site.

Graham

Feb 17 '06 #2
> Does mod_python time out after a minute ?

No, but the browser may timeout. Sending a periodic bit-o-data on a
long running page is a good idea anyway (so the user knows it is still
working).
If I leave an HTTP connection open so that the content keeps loading inside the
browser window indefinately, and if I close the browser window, the
mod_python process is terminated, right?


In general this is not an issue. However it depends to some degree on
what your mod_python program is doing. Here is a really, REALLY feeble
example w/publisher:

def ping(req, target_ip):
import commands
output = commands.getout put('ping -c 10000 %s' % target_ip)
return output

Even if the user closes the window or hits 'stop' the process stays
until the ping finishes. In this example this is merely annoying (10k
pings takes almost 3 hours) but if it had been 'fping -el %s' instead
you would be in real trouble (since it would never exit).

Restarting apache clears such zombie processes.

btw, 'ping' as written above is horrible. If a code review turned
_that_ up on production someone would be fired, along with whoever
hired them, whoever ate lunch with them and anyone that waves goodbye.

Feb 17 '06 #3
On Thu, 16 Feb 2006 21:35:13 -0300, Kane <ja**********@g mail.com> wrote:
btw, 'ping' as written above is horrible. If a code review turned
_that_ up on production someone would be fired, along with whoever
hired them, whoever ate lunch with them and anyone that waves goodbye.


Really? Wow... Gotta be carefull from now on...
--
Charles.

Desenvolvimento e criação de sites: www.auriance.com
Hospedagem de sites e servidores dedicados: www.auriance.net
Feb 17 '06 #4

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

Similar topics

1
270
by: Paul | last post by:
Hi I posted this as new since was not sure older posts are responded to. Anyhow the problem is a connection being left open, and has only happended a few times. This is code that someone else developed and I have modified. I did add a section of code that uses a data connection, data adapter, and a dataset. It calls a stored procedure on the server. I did not use open or close in the code but it seemed to be working ok. The stored...
3
1387
by: jimb | last post by:
I'm just starting to learn asp.net. What I have is a registration form for a message board system. Basically, the user enters in their info and it's validated. So I have a custom validator check to make sure the username is unique, I have another custom validator that makes sure the email address is unique and then I save the info to the database. That means I open the connection to the sqlserver 3 times. Seems inefficient to me. Is...
5
3103
by: yinglcs | last post by:
Hi, I am new to python. I read an example here about how to fetch data thru a HTTP connection: http://diveintopython.org/http_web_services/review.html, My question is how can i save the data to a file after reading it from a http connection. Thank you.
4
1536
by: Marine | last post by:
Hi, My project must connect to a Sql Server quite often to read/write datas. I am wondering : do i have to open the connection to the Sql Server at the beginning when the application loads, then leave the connection open and close it when the application closes ? Or is it more efficient toopen and close the connection each time i have to use a datareader, a command etc... Thanks !
2
1929
by: Tony Johansson | last post by:
Hello! How does this connection pool function actually ? As I have been told is that when the connection is returned to the pool the connection to the database is still open. What you do is that you just return a still open connection to the pool. When I open a connection I get an already open connection to the database. Is this correct understood ?
2
2449
by: TG | last post by:
Hi! Once again I have hit a brick wall here. I have a combobox in which the user types the server name and then clicks on button 'CONNECT' to populate the next combobox which contains all the databases in that server. Then after the user selects a database, I have another button that he/she click and I want to retrieve file groups from a specific table. At this point when he/she clicks on that button I get an error:
1
2789
by: vikassawant | last post by:
Hi, I m facing some critical problem for downloading 5mb file from server. Does anyone know? How to reduce the time to download file from server using HTTP connection?
0
2584
by: johnyjj2 | last post by:
Hello! I'd like to run mssql script (file with extension sql). I installed Microsoft SQL Server 2008 and run in Command Prompt: C:\Documents and Settings\useruser>osql -Usa -Ppassword -i "F:\Data\MyApplication\Scripts\CreateDb.sql" Named Pipes Provider: Could not open a connection to SQL Server . Login timeout expired A network-related or instance-specific error has occured while establishing a connection to SQL Server. Server is not...
1
2694
by: webster5u | last post by:
Hi, who's has experience to open connection pool in Tomcat 5.5 using JNDI? I recently research on it, i found the how-to guideline provided from apache tomcat website. It seem like not really work and i saw some of article they also encounter same issue as me. if i put the datasource in context.xml then immediately the Tomcat not working. If you put it in the server.xml then it unable detect the datasource. I has success open database...
0
9578
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9413
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10030
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9848
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8851
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5292
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5431
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3547
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2810
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.