Re: Threading issue in 5.6 and 5.8

2003-08-14 Thread Mustafa Tan
Hi Stas,
here is the google groups page that defines the
problem.

http://groups.google.com/groups?hl=enlr=lang_enie=UTF-8threadm=7j14it%248v1%241%40zonnetje.NL.netrnum=1prev=/groups%3Fnum%3D100%26hl%3Den%26lr%3Dlang_en%26ie%3DISO-8859-1%26q%3DIO%253A%253ASocket%253A%253AINET%2Bmod_perl%2BWindows%2BNT%26sa%3DN%26tab%3Dwg

Basically it says the following:

Hello.

I'm having a problem with IO::Socket::INET using
Apache mod_perl. I'm using
ModPerl 1.19,
Perl 5.005_03 and Apache 1.3.6 on my NT system.  I've
included a small
sample program below that demonstrates the behaviour.
The basic problem I am having is as follows:
The first time I get the page it works correctly.
However, if I reload the page, no output is
returned.
But, by pressing reload repeatedly, I noticed that
every 5 times, it
works correctly.
As if refusing to return anything wasn't bad
enough, no error is given.
Any suggestions would be greatly appreciated.

Thanks,

Mark.

Here is the possible solution, which actually works:

I actually just found the problem this morning.  It
was a server problem.
An NT thing I guess.  I changed the ThreadsPerChild
setting to 1 in my
httpd.conf file.
The problem disappeared right away.


--- Stas Bekman [EMAIL PROTECTED] wrote:
 Ged Haywood wrote:
  Hi there,
  
  On Thu, 7 Aug 2003, Mustafa Tan wrote:
  
  
 script's name is A, and I execute the same script
 20
 times subsequently there is no problem. But if I
 execute B after A, and then execute A again, then
 I
 have a problem and the problem is that there is a
 socket error. This happens only on Windows
 machines. I
 learnt that this is a common problem and that it
 is
 because of threads. Making number of threads on
 apache
 1 solves the problem
 
 I doubt this has anything to do with threads,
 because they are serialized in 
 mod_perl 1.0  on windows. Do you use mod_perl 2.0?
 
 Most likely your problem is the usual one: global
 variables persist under 
 mod_perl and you have to reset them before using.
 For more information see:

http://perl.apache.org/docs/1.0/guide/porting.html#Global_Variables_Persistence
 
 In any case when reporting problems you should at
 least copy-n-paste the exact 
 error. And follow the guidelines:
 mp1:

http://perl.apache.org/docs/1.0/guide/help.html#How_to_Report_Problems
 mp2:

http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems
 
  Sorry I know prcatically nothing about running
 Apache on Windows.
  Seems strange to me that anyone would do it... :)
 
 This is correct for mod_perl 1.0, because threads
 are serialized to make 
 things thread-safe.
 
 But this is no longer valid for mod_perl 2.0.
 mod_perl 2.0 on windows should 
 be as good as on any other system.
 
 Ok, here is the real question. Should I move to
 5.8
 and if I should, what are the general issues that
 I
 have to be careful about. One more thing is that,
 can
 I run perl 5.8 with mod_perl 1.0? Is that
 possible, or
 do I also have to move to mod_perl 2 and apache 2?
  
  
  You can run 5.8.x with mod_perl 1.x, the issue you
 will most likely
  meet involves character encoding.  Check the
 archives of this List
  for more information.  Look for UTF-8 and/or
 locale.
 
 This is correct only for several RedHat linux
 versions. it should be fixed in 
 RH9.1:

http://archive.develooper.com/[EMAIL PROTECTED]/msg97360.html
 
  Version 2 of Apache/mod_perl might enable you to
 address some of your
  threading problems on Windows, hopefully others
 will be able to tell
  you more than I can.
  
  73,
  Ged.
 
 
 -- 
 
 

__
 Stas BekmanJAm_pH -- Just Another
 mod_perl Hacker
 http://stason.org/ mod_perl Guide ---
 http://perl.apache.org
 mailto:[EMAIL PROTECTED] http://use.perl.org
 http://apacheweek.com
 http://modperlbook.org http://apache.org  
 http://ticketmaster.com
 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


Threading issue in 5.6 and 5.8

2003-08-07 Thread Mustafa Tan
Hi everybody,
I have a simple script that uses POP3Client to
retrieve emails. It turns out that I can run this
script only once, or more if all the subsequent
requests are to the same script. That is say, my
script's name is A, and I execute the same script 20
times subsequently there is no problem. But if I
execute B after A, and then execute A again, then I
have a problem and the problem is that there is a
socket error. This happens only on Windows machines. I
learnt that this is a common problem and that it is
because of threads. Making number of threads on apache
1 solves the problem, but then a refresh is extremely
slow, cause it seems KeepAlive makes the thread stop
responding to the refresh until keep alive times out. 

Ok, here is the real question. Should I move to 5.8
and if I should, what are the general issues that I
have to be careful about. One more thing is that, can
I run perl 5.8 with mod_perl 1.0? Is that possible, or
do I also have to move to mod_perl 2 and apache 2?

Thanks

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


Re: must I use mod-perl

2003-07-13 Thread Mustafa Tan
Hi Bulba007,
You should use mod_perl when and if your CGI need is
more complex than a set of CGI scripts. For example
you need better performance, better control of the
whole process, such as authorization, authentication,
etc.., you need to implement real sound web
applications, etc...

mod_perl is really like the next step for the perl
CGI. If you want to be able to write web
applications, then use mod_perl. Otherwise, I think
you are pretty much ok with CGI. 

--- Bulba007 [EMAIL PROTECTED] wrote:
 When must I to use mod_perl? It is necessary?
 
 B.
 
 
 


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com


Dynamically banning hosts

2003-07-11 Thread Mustafa Tan
Is it possible to dynamically ban IP addresses using
mod_perl. Like even the first connection from the
specified ip will be rejected. I know that you can do
this using httpd.conf but I am wondering how to do the
same dynamically while Apache is running.

Also how can I cope with denial of service attacks? I
know there is no general solution to this, but is
there a particular technique to ease the problem. The
environment is one host that serves small number of
people with a very limited bandwidth.

Thanks

__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com


Few Important Questions

2003-06-18 Thread Mustafa Tan
Hi Everybody,
mod_perl is a great software. Thanks for everybody who
spent time on it and make it available. When you send
a reply to this, can you also describe how we can
help, as an individiual, to support mod_perl and
people behind it financially.

Now here are some of my questions. I am working on a
project that will enable people, regular people, to
use their computers remotely using apache and a web
browser. 

I have various questions though. I started this with
CGI, then migrated to mod_perl. However I want to
bring a very general solution to the problem, so that
developers can develop in any language they want.

Number one issue is that, I selected perl because
that's how I get started. Now I am using mod_perl for
speed and various other issues. But what is the
fastest solution out there. This application is
supposed to run on a standalone PC, so it doesn't have
to scale well, but it has to be as fast as possible.
Is mod_perl the fastest solution available, other than
the C of course. How does it compare to java.

Second, what are my options if I want to combine
mod_perl with other solutions, such as php, java and
so on. One problem seem to be the session management.
The second problem is that I want to be able to mix
perl files with php files. For example the directory
which should be handled by mod_perl should also have
php files which should also run fine.

Another question is that, why hosting guys avoid using
mod_perl. Is it just because mod_perl is memory
hungry? 

Finally how can I dynamically ban an ip address in
mod_perl. For example, normally you can specify
certain ip addresses with Allow, Deny directives. How
can I do that dynamically using mod_perl.

You can answer any of the above. Thanks

__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com


Problem with mod_ssl and mod_perl on Windows

2003-06-10 Thread Mustafa Tan
Hi,
I was trying to setup Apache (with mod_perl and
mod_ssl) on Windows ME, and I had a weird problem. 

Before the problem, let me talk about more about some
details. I have installed Apache from
http://perl.apache.org/dist/win32-bin/. I installed
the perl 5.6 version, which is perl-win32-bin.exe.
THis file contains Perl 5.6 and Apache 1.3.27. It also
contains mod_perl and mod_ssl. 

After installation I did not use the perl that the
package came with. I used my ActivePerl (which is
5.6), because I already installed lots of packages
there and there is no difference anyway. 

In my previous installation of Perl (activeperl) I had
mod_perl installed, however that mod_perl was not for
eapi, so I removed it and installed the one for eapi
from the canadian web site. I installed
mod_perl-eapi.ppd. 

http://theoryx5.uwinnipeg.ca/ppmpackages/

So anyway, I had mod_perl setup for perl and apache. 

I configured my apache so that it listens both on 443
for secure connections and 80 too. 

Now, let me talk about how I use mod_perl for my site.
I use AuthCookieURL for authentication and
authorization. What I do is essentially, get the
user's name and password in a page and then authorize
the user for the other pages. This works fine, until I
used mod_ssl for secure connections.

When I tested the apache, it works just fine for port
80. However, it doesn't work very well, on port 443.
The second request to the https port crashes Apache.
Now as far I as I understood the second request
crashes the child process. I am not sure about the
internals of Apache. What happens is that, the first
request is always fine, only the second request
crashes the server. The child process dies, Apache
parent process creates the child process again and
then everything works fine again until the next 2
requests, except of course I have to press Ok to
shutdown the Apache's error box. That is the error
does prevent me using Apache for secure connections.

Anyway, I spent quite some time on it, and I tracked
down the problem to the following. There are two
problems, and let me describe how I solved the first
one and how I couldn't solve the second one.

The first one was that, when the user first requests a
page, he/she has to login. In this phase, the
AuthCookieURL module shows the custom login page. This
happens by a redirection, using custom_message or
something like that. I forgot its name now. Anyway,
this method as you know receives a return value (in
this case it is FORBIDDEN) and a messsage or a
relative url. Normally it is a relative url, like
/public/login.pl. This is the default way I use this
module, and it normally works fine. However, in https
requests the second request causes Apache crash,
unless I change this method so that it actually
returns the output as string. That is instead of a
redirection to login.pl, I send the login page in the
second argument using the custom_error method. If I
make this change, Apache doesn't crash anymore. 

Ok, now the next step is fixing the authorization
phase. Assuming that the user already supplied the
correct user/password, he/she can enter to the site.
However once he/she enters, the user can not make two
subsequent requests without crashing the Apache. I
tracked down this problem to the return value of the
authorize method of AuthCookieURL. If this method
returns OK, which means that the user can enter, it
crashes, if the method returns DECLINED, it doesn't
crash, but it certainly doesn't show anything either,
cause it says Forbidden , you don't have access
message. I couldn't fix this problem. It just seems
that there is no way around this. 

What I found in the ssl.log is that, basically OpenSSL
crashes with I/O errors. It says like expected to read
5 bytes The error somehow indicate to me that,
maybe I added the modules in the wrong way. I have
changed them, but again, it didn't work. That is I
added mod_perl last, mod_ssl last and so on, but the
net result was the same.

Overall, the problem seem to be somewhat related with
the phases.

If anybody can help me to fix the problem, I would be
thankful. 

Thanks 

__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com