Re: configuring Apache::Session to detect no-cookie browser
Hi, After reading an interesting thread here about session management I would like to detect if the user's browser refuses cookies and switch Apache::Session from cookie mode to URL mangling mode. Has someone already tackled this and would be so kind to share the solution? We are playing around with this at the moment in a mason based site: what we do is.. If a request comes in with no session id (either in cookie or path): check list of "cookies sent to" browsers (keyed by client ipaddress). If we haven't seen this host recently (we currently remember the last 50 cookie attempts) then attempt to issue a cookie, otherwise insert a session id at head of path. If we apparently have a session id in the request, validate the requestor session (we don't want to force users to login for the free part of the site: we would rather tease them in get them to register sometime later) by : 1. checking session is still active 2. checking {remoteip address,User-Agent} for user with that stored in the session database in case a path based session has been passed between users. If these checks fail then initiate a new session. We have a further wrinkle on this in that we attempt to detect visits from search engine trawlers by looking at the User-Agent field never use path based sessionids for them (they mostly don't return cookies) -- I didn't like the idea of publishing sessionids on search engine listings. Because of their usage pattern with a bit of care in the use of session data we have constructed a site which still works when entered at any page with a virgin user session. For 'sensitive' areas of the site the user must validate themselves against the session they purport to be using. All in all this is very tedious! regards, David Lamkin [EMAIL PROTECTED]
configuring Apache::Session to detect no-cookie browser
Hi, After reading an interesting thread here about session management I would like to detect if the user's browser refuses cookies and switch Apache::Session from cookie mode to URL mangling mode. Has someone already tackled this and would be so kind to share the solution? TIA -- Louis-David Mitterrand - [EMAIL PROTECTED] - http://zzz.apartia.org/ldm/
Apache::Session question
Hi! I am sorry to ask this bit off question, but still. Has anyone used Apache::Session on Solaris (Sparc, not intel)? We implemented system on Linux (intel) and tried to port it to Solaris, but session doesn't work - can not create session files. Store manager used is FileStore and SysV locker. Could that be a reason for problems? If so what kind of store and locker should be used on sparc Solaris? Thanks inadvance, Gundars //--- // Project manager // JSC Dati // Kuldigas 45 // LV-1083, Riga // Latvia // Tel: +371-706 // Fax: +371-7619573 // Mob: +371-9466055 //---
Re: Apache::Session question
Gundars Kulups wrote: Hi! I am sorry to ask this bit off question, but still. Has anyone used Apache::Session on Solaris (Sparc, not intel)? We implemented system on Linux (intel) and tried to port it to Solaris, but session doesn't work - can not create session files. Store manager used is FileStore and SysV locker. Could that be a reason for problems? If so what kind of store and locker should be used on sparc Solaris? After the use Apache::Session you maybe have to type something like this. $Apache::Session::SysVSemaphoreLocker::nsems=16; This has been talked here before, so maybe if this doesn't work you can find hints anywhere in the list archives. -- - frankie -
Re: Apache::Session question
On Fri, May 05, 2000 at 05:58:33PM +0200, Francesc Guasch wrote: [Solaris + Apache::Session] After the use Apache::Session you maybe have to type something like this. $Apache::Session::SysVSemaphoreLocker::nsems=16; In my preliminary testing, it appears this is also necessary to get SysVSem working on FreeBSD 3.x (I'm not running 4, but it may also apply there). Can someone confirm this? I had some problems with Apache::Session, tried the above fix, and it seemed to work, but I haven't used Apache::Session since, so I can't be sure. If it IS necessary, it should probably be added to the guide and / or comments in the Apache::Session .pm that controls this (can't remember the filename offhand, but it had a comment referring to Solaris + nsems=16 or 8). TIA -- Neil Conway [EMAIL PROTECTED] Get my GnuPG key from: http://klamath.dyndns.org/mykey.asc Encrypted mail welcomed It is dangerous to be right when the government is wrong. -- Voltaire PGP signature
What's next for Apache::Session
The next version of Apache::Session is almost ready. This version is dubbed 1.50 because of it's significant-but-not-outrageous changes. The changes from 1.03 are: 1) New backing stores can stash data in Berkeley DB via the BerkeleyDB module, or any dbm format via AnyDBM_File. 2) The ID generator and the data serializer are no longer hard-wired into the Session superclass. They are pluggable and interchangeable in the same way that the backing store and locking manager are in 1.03. This was done mainly for people who implement non-jwb session ID policies and to increase compatibility with non-mysql databases. Users of postgres can now create ASCII serialized sessions by using the Base64 serializer. FreezeThaw serialization is also supported. 3) The new interface class Apache::Session::Flex allows the runtime specification of the backing store, lock manager, serializer, and ID generator. This was by popular demand, and should benefit rapid development as well as other systems like Embperl and ASP. 4) The DBI interface class has been modified to accept an already-open DBI handler as an argument. 5) New interface classes have been added for Apache::Session::Postgres, ::Sybase, and ::Oracle. These are special cases of ::Flex. That is all. I'm working on it this weekend if anyone has any more suggestions. Regards, Jeffrey
Re: What's next for Apache::Session
On Fri, Apr 28, 2000 at 03:25:18PM -0700, Jeffrey W. Baker wrote: The next version of Apache::Session is almost ready. This version is dubbed 1.50 because of it's significant-but-not-outrageous changes. The changes from 1.03 are: ... 4) The DBI interface class has been modified to accept an already-open DBI handler as an argument. Excellent! 5) New interface classes have been added for Apache::Session::Postgres, ::Sybase, and ::Oracle. These are special cases of ::Flex. I currently modify the connection sub in DBIStore.pm as follows: sub connection { my $self= shift; my $session = shift; return if (defined $self-{dbh}); $self-{dbh} = DBI-connect($session-{args}-{DataSource}, $session-{args}-{UserName}, $session-{args}-{Password}, { RaiseError = 1, AutoCommit = 1, LongReadLen = $session-{args}-{LongReadLen} }) || die $DBI::errstr; } i.e. I pass the LongReadLen parameter for Oracle. Would something like this be a part of the new ::Oracle interface class? Ajit
Re: What's next for Apache::Session
ditto! - Original Message - From: Igor Chudov @ home [EMAIL PROTECTED] To: Jeffrey W. Baker [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, April 28, 2000 8:11 PM Subject: Re: What's next for Apache::Session reuse of already open database handles is what I was parying for. I use oracle - Igor.
Where to get Apache::Session
Hi, Can somebody please tell me from where to download Apache::Session module. Thanks a lot Murali Differentiated Software Solutions Pvt. Ltd., 176, Gr. Floor, 6th Main 2nd Block RT Nagar Bangalore - 560 032 India Ph: 91 80 3431470 email : diffs+AEA-vsnl.com http://www.diffs-india.com
FW: Apache::Session::SysV - No space left on device
I forward it to the modperl list, hopefully somebody there know more about Semaphores... Gerald -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Neil Conway Sent: Sunday, April 16, 2000 4:32 AM To: [EMAIL PROTECTED] Subject: Apache::Session::SysV - No space left on device Hello everyone, I'm using FreeBSD 3-STABLE, mod_perl 1.22, Apache 1.3.12, and HTML::Embperl 1.3b2 on an x86 machine. I'm a newbie trying to get Apache::Session to work (through HTML::Embperl). This is part of my startup.pl: % use constant DB_INFO = 'DBI:Pg:dbname=template1'; BEGIN { $ENV{EMBPERL_SESSION_CLASSES} = 'DBIStore SysVSemaphoreLocker'; $ENV{EMBPERL_SESSION_ARGS} = 'Datasource=' . DB_INFO; } % When I try to access a simple HTML::Embperl using %mdat or %udat, I get the following error: [5596]ERR: 24: Line 10: Error in Perl code: No space left on device at /usr/local/lib/perl5/site_perl/5.005/Apache/Session/SysVSemaphoreLocker.pm line 63. The output of 'ipcs -as' is as follows: Semaphores: T ID KEYMODE OWNERGROUP CREATOR CGROUP NSEMS OTIMECTIME s 655365432014 --rw--- postgres postgres postgres postgres 16no-entry 5:49:28 s 655375432015 --rw--- postgres postgres postgres postgres 16no-entry 5:49:28 Apache is running as user 'nobody', group 'nobody'. A similar thread was mentioned before on the modperl list (http://forum.swarthmore.edu/epigone/modperl/spaygelthang/23142101.NAA14 [EMAIL PROTECTED]), but no one responded. That poster was trying to use Apache::Session with SysVSemaphoreLocker and OpenBSD. What am I doing wrong? Do I need to allow Apache::Session to create semaphores? How would I do that? TIA -- Neil Conway [EMAIL PROTECTED] Get my GnuPG key from: http://klamath.dyndns.org/mykey.asc Encrypted mail welcomed Never criticize anybody until you have walked a mile in their shoes, because by that time you will be a mile away and have their shoes.
Apache::Session beginner
Does anyone know any good resources for learning about Apache::Session ? Thanks, Tom
Re: Apache::Session beginner
Besides the pod docs there's another usage description in the guide: http://perl.apache.org/guide/modules.html#Apache_Session_Maintain_session If you're looking to use Apache::Session::DBI, then you'll need to run down the docs for you're database of choice. Cheers, Jeff At 07:43 PM 4/16/00, Tom Peer wrote: Does anyone know any good resources for learning about Apache::Session ? Thanks, Tom Jeff Beard ___ Web:www.cyberxape.com Phone: 303.443.9339 Location: Boulder, CO, USA
SOLVED: Segfault with Embperl, Apache::Session (piece of %@#!*)
Fickle, fickle machines. The segfault problem with Embperl and Apache::Session can be fixed with about 3 keystrokes in emacs. When I was getting the segfault error I had: # BEGIN EMBPERL SESSION HANDLING PerlSetEnv EMBPERL_SESSION_CLASSES "DBIStore SysVSemaphoreLocker" PerlSetEnv EMBPERL_SESSION_ARGS "DataSource=dbi:mysql:sessions UserName=root" PerlRequire startup.pl PerlModule Apache::AuthenDBI PerlModule HTML::Embperl If you move the PerlRequire below PerlModule HTML::Embperl everything works. Of course, it makes sense because startup.pl has the line for setting nsems for Apache::Session::SysVSemaphoreLocker and Embperl loads that module for you so startup.pl needs to load after Embperl. The interesting thing is that with perl5.004 I was getting segfaults. After building perl5.005 and rebuilding all the modules, apache and mod_perl I no longer got segfaults but got Invalid argument errors from SysVSemaphoreLocker. Either perl5.005 or the newer versions of Apache::Session or IPC::Semaphore are a little bit more tolerant to misplaced parameters. Gerald, if it's not on the wish list already, could you add a request for the ability to set nsems in EMBPERL_SESSION_ARGS. Or maybe I should just get off my butt and make a patch. -- Jason Bodnar + [EMAIL PROTECTED] + Tivoli Systems Homer: We always have one good kid and one lousy kid. Why can't both our kids be good? Marge: We have three kids, Homer. Separate Vacations
RE: SOLVED: Segfault with Embperl, Apache::Session (piece of %@#!*)
Gerald, if it's not on the wish list already, could you add a request for the ability to set nsems in EMBPERL_SESSION_ARGS. Or maybe I should just get off my butt and make a patch. This works already. You can give any arguments to EMBPERL_SESSION_ARGS that a Store or Locker module accepts. Embperl only pass them thru. e.g. PerlSetEnv EMBPERL_SESSION_ARGS "DataSource=dbi:mysql:sessions UserName=root NSems=16" Gerald - Gerald Richterecos electronic communication services gmbh Internetconnect * Webserver/-design/-datenbanken * Consulting Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925151 WWW:http://www.ecos.de Fax: +49 6133 925152 -
RE: Segfault with Embperl, Apache::Session
On 13-Apr-2000 Gerald Richter wrote: Trying to use Apache::Session with Embperl 1.2.1, mod_perl 1.21, Apache 1.3.9. I've got this running on another machine just fine with the exact same setup (I think). When I try access an Embperl page that uses %udat I get: [Thu Apr 13 14:51:05 2000] [notice] Apache/1.3.9 (Unix) mod_perl/1.21 configured -- resuming normal operations panic: restartop [Thu Apr 13 14:51:23 2000] [notice] child pid 14373 exit signal Segmentation Fault (11) Any chance to get a stack backtrace from gdb? Is mod_perl link staticly into Apache or loaded as DSO? If the second, than upgrade to mod_perl 1.22 If you tell me what to do I'll try to get a stack backtrace. mod_perl is staticly linked. -- Jason Bodnar + [EMAIL PROTECTED] + Tivoli Systems Second class? What about Social Security, bus discounts, Medic-Alert jewelery, Gold Bond powder, pants all the way up to your armpits, and all those other senior perks? Oh, if you ask me, old folks have it pretty sweet. -- Homer Simpson Raging Abe Simpson and His Grumbling Grandson in "The Curse of the Flying Hellfish"
Re: Segfault with Embperl, Apache::Session
On 13-Apr-2000 Mark Ng wrote: can you tell me the following about your 2 systems (the one that works and the new one), I have the same problem. I need to know: Versions of: Perl Both are 5.004_04 apache Both are 1.3.9 modperl Both are 1.21 embperl Both are 1.2.1 OS (Exact version and path level) Machine where I'm getting the errors: SunOS esc-dev 5.7 Generic_106541-04 sun4u sparc Machine where it works: SunOS twidow.dev.tivoli.com 5.6 Generic_105181-16 sun4u sparc Hmmm ... maybe it's a problem with Solaris 5.7? cc compiler used. Used gcc 2.8.0 for everything. Mark Jason Bodnar wrote: Trying to use Apache::Session with Embperl 1.2.1, mod_perl 1.21, Apache 1.3.9. I've got this running on another machine just fine with the exact same setup (I think). I created a db called sessions with a table called sessions: mysql show fields from sessions; +---+-+--+-+-+---+ | Field | Type| Null | Key | Default | Extra | +---+-+--+-+-+---+ | id| varchar(16) | | PRI | | | | length| int(11) | YES | | NULL| | | a_session | text| YES | | NULL| | +---+-+--+-+-+---+ 3 rows in set (0.00 sec) When I try access an Embperl page that uses %udat I get: [Thu Apr 13 14:51:05 2000] [notice] Apache/1.3.9 (Unix) mod_perl/1.21 configured -- resuming normal operations panic: restartop [Thu Apr 13 14:51:23 2000] [notice] child pid 14373 exit signal Segmentation Fault (11) -- Jason Bodnar + [EMAIL PROTECTED] + Tivoli Systems Homer: Well, the evening began at the Gentleman's Club, where we were discussing Wittgenstein over a game of backgammon. Scully: Mr. Simpson, it's a felony to lie to the FBI. Homer: We were sitting in Barney's car eating packets of mustard. Ya happy? The Springfield Files - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Bodnar + [EMAIL PROTECTED] + Tivoli Systems I strive for greatness but will settle for mediocrity. -- Jason Bodnar
RE: Segfault with Embperl, Apache::Session
Trying to use Apache::Session with Embperl 1.2.1, mod_perl 1.21, Apache 1.3.9. I've got this running on another machine just fine with the exact same setup (I think). When I try access an Embperl page that uses %udat I get: [Thu Apr 13 14:51:05 2000] [notice] Apache/1.3.9 (Unix) mod_perl/1.21 configured -- resuming normal operations panic: restartop [Thu Apr 13 14:51:23 2000] [notice] child pid 14373 exit signal Segmentation Fault (11) Any chance to get a stack backtrace from gdb? Is mod_perl link staticly into Apache or loaded as DSO? If the second, than upgrade to mod_perl 1.22 Gerald - Gerald Richterecos electronic communication services gmbh Internetconnect * Webserver/-design/-datenbanken * Consulting Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925151 WWW:http://www.ecos.de Fax: +49 6133 925152 -
RE: Segfault with Embperl, Apache::Session
If you tell me what to do I'll try to get a stack backtrace. http://perl.apache.org/embperl/Faq.pod.1.html#make_test_fails_with_a_SIG _ Gerald
RE: Segfault with Embperl, Apache::Session
#0 0xff1d7540 in Perl_sv_clear () from /opt/gnu/depot/perl5.004_04/lib/sun4-solaris/5.00404/CORE/libperl.so It crashs somewhere deep inside of Perl, so it's hard to say what's happeing here. I would first try to recompile all modules (maybe Perl itself also), to make sure things fit together Gerald
Re: Segfault with Embperl, Apache::Session
On Thu, 13 Apr 2000, Jason Bodnar wrote: Hmmm ... maybe it's a problem with Solaris 5.7? Can you try the binaries from the 2.6 box on the 2.7 box to see if that works? That would at least kind of indicate whether it's an OS bug or a configuration bug. -Mark
Re: Segfault with Embperl, Apache::Session
The binaries on both boxes are the same. They get rdist'd out from one machine every night. I'm going to rebuild the latest versions of everything on the 2.7 machine tomorrow and see if that makes a difference. At 10:57 PM 4/13/00 -0400, Mark Imbriaco wrote: On Thu, 13 Apr 2000, Jason Bodnar wrote: Hmmm ... maybe it's a problem with Solaris 5.7? Can you try the binaries from the 2.6 box on the 2.7 box to see if that works? That would at least kind of indicate whether it's an OS bug or a configuration bug. -Mark -- Jason Bodnar + Tivoli Systems = [EMAIL PROTECTED]
Segfault with Embperl, Apache::Session
Trying to use Apache::Session with Embperl 1.2.1, mod_perl 1.21, Apache 1.3.9. I've got this running on another machine just fine with the exact same setup (I think). I created a db called sessions with a table called sessions: mysql show fields from sessions; +---+-+--+-+-+---+ | Field | Type| Null | Key | Default | Extra | +---+-+--+-+-+---+ | id| varchar(16) | | PRI | | | | length| int(11) | YES | | NULL| | | a_session | text| YES | | NULL| | +---+-+--+-+-+---+ 3 rows in set (0.00 sec) When I try access an Embperl page that uses %udat I get: [Thu Apr 13 14:51:05 2000] [notice] Apache/1.3.9 (Unix) mod_perl/1.21 configured -- resuming normal operations panic: restartop [Thu Apr 13 14:51:23 2000] [notice] child pid 14373 exit signal Segmentation Fault (11) -- Jason Bodnar + [EMAIL PROTECTED] + Tivoli Systems Homer: Well, the evening began at the Gentleman's Club, where we were discussing Wittgenstein over a game of backgammon. Scully: Mr. Simpson, it's a felony to lie to the FBI. Homer: We were sitting in Barney's car eating packets of mustard. Ya happy? The Springfield Files
RE: Segfault with Embperl, Apache::Session
this copy-n-paste from ~/Mail/.sent-mail-dec-1999 might help: --- a few things could shed some more light: build a libperld.a and compile with PERL_DEBUG=1 (see SUPPORT doc) and/or, in gdb: (gdb) source mod_perl-1.21/.gdbinit (gdb) curinfo should tell you the line/filename of the offending Perl code add this to the .gdbinit (which is in the modperl cvs tree): define longmess set $sv = perl_eval_pv("Carp::longmess()", 1) printf "%s\n", ((XPV*) ($sv)-sv_any )-xpv_pv end (gdb) longmess should produce a Perl stacktrace
Apache::Session -- Go Out of Scope!!!
I'm using Apache::Session within a large Web application (consisting of many scripts). We also have multiple developers on this project, some of whom are junior developers with only a bit of mod_perl experience. In any case, I've written a custom session package that wraps to Apache::Session. It uses Apache::Session for persistence, but it adds nice functionality to it (cookies, session time-out, etc.). Normally, this works great. No problem at all. This object goes out of scope at the end of the script (it's scoped lexically with "my"). It also goes out of scope when "die" is explicitly called. If I add "die 'Blah blah blah'" to an app, things are fun. BUT... sometimes when there's a syntax error in the code, this object just stays in scope. This causes a real problem, because then the developer will just re-load. The process will sit there forever, waiting for the session lock to go away. But it never does... This is a problem. Under certain strange circumstances, the object does not go out of scope. Even under PerlRun (which I *thought* would clear the application's namespace at the end of execution), the object stays in scope (I print to STDERR in DESTROY to see this). The mod_perl server starts going crazy spawning off new threads for each request, because current threads are busy. I placed some limits on this in httpd.conf, but this is not really a solution. The only solution is to restart the server... But there's gotta be a better way! This has been plaguing us for a while, and I can't figure it out. I was considering writing a $SIG{__DIE__} handler that would take this object out of scope, but I ran into other issues there. Has anyone else run into this problem? Any suggestions? Thanks, Russ Russell Weiss Founder and Technical Manager InfoRelay Online Systems, Inc. http://www.InfoRelay.net/
Re: Apache::Session -- Go Out of Scope!!!
On Fri, 7 Apr 2000, Russell D. Weiss wrote: I'm using Apache::Session within a large Web application (consisting of many scripts). We also have multiple developers on this project, some of whom are junior developers with only a bit of mod_perl experience. In any case, I've written a custom session package that wraps to Apache::Session. It uses Apache::Session for persistence, but it adds nice functionality to it (cookies, session time-out, etc.). Normally, this works great. No problem at all. This object goes out of scope at the end of the script (it's scoped lexically with "my"). It also goes out of scope when "die" is explicitly called. If I add "die 'Blah blah blah'" to an app, things are fun. BUT... sometimes when there's a syntax error in the code, this object just stays in scope. This causes a real problem, because then the developer will just re-load. The process will sit there forever, waiting for the session lock to go away. But it never does... My advice would be to eliminate the syntax errors in your code. Apache::Session wasn't designed with the goal of working around other people's erroneous code! This is a problem. Under certain strange circumstances, the object does not go out of scope. Even under PerlRun (which I *thought* would clear the application's namespace at the end of execution), the object stays in scope (I print to STDERR in DESTROY to see this). There are some bugs in Perl 5.005_03 which sometimes cause adverse interactions between eval and die. One symptom seems to be that lexical objects become immortal. This is pretty rare, though. Can you try Perl 5.6? The mod_perl server starts going crazy spawning off new threads for each request, because current threads are busy. I placed some limits on this in httpd.conf, but this is not really a solution. The only solution is to restart the server... But there's gotta be a better way! This has been plaguing us for a while, and I can't figure it out. I was considering writing a $SIG{__DIE__} handler that would take this object out of scope, but I ran into other issues there. Has anyone else run into this problem? -jwb
Re: Apache::Session -- Go Out of Scope!!!
On Fri, 7 Apr 2000, Russell D. Weiss wrote: Normally, this works great. No problem at all. This object goes out of scope at the end of the script (it's scoped lexically with "my"). It also goes out of scope when "die" is explicitly called. If I add "die 'Blah blah blah'" to an app, things are fun. BUT... sometimes when there's a syntax error in the code, this object just stays in scope. This causes a real problem, because then the developer will just re-load. The process will sit there forever, waiting for the session lock to go away. But it never does... You could try using a PerlCleanupHandler to kill any open locks. $r-register_cleanup( \clear_locks ); - Perrin
Apache::Session and IPC::Semaphore
I get an intermittent error using Apache::Session while trying to tie a session. It occurs sometimes and the only way to fix it I've found is to reboot. The weird thing is that I change nothing and rebooting fixes it. Looks like a semaphore problem. Why would the call: new IPC::Semaphore give a Permission denied error? Has anyone else ran into this problem? Any help greatly appreciated... My system: RedHat 6.1 (also occurs on RedHat 6.2) RH Secure Server 2.0 (Apache 1.3.3) mod_perl 1.21 Apache::Session 1.03 apache error_log [Fri Apr 7 20:13:46 2000] [error] Permission denied at /usr/lib/perl5/site_perl/5.005/Apache/Session/SysVSemaphoreLocker.pm line 63. (in cleanup) Permission denied at /usr/lib/perl5/site_perl/5.005/Apache/Session/SysVSemaphoreLocker.pm line 63. Database handle destroyed without explicit disconnect at /usr/lib/perl5/site_perl/5.005/Apache/AuthCookie.pm line 48.
Re: Apache::Session and IPC::Semaphore
On Fri, 7 Apr 2000, Adi wrote: I get an intermittent error using Apache::Session while trying to tie a session. It occurs sometimes and the only way to fix it I've found is to reboot. The weird thing is that I change nothing and rebooting fixes it. Looks like a semaphore problem. Why would the call: new IPC::Semaphore give a Permission denied error? Has anyone else ran into this problem? Any help greatly appreciated... My system: RedHat 6.1 (also occurs on RedHat 6.2) RH Secure Server 2.0 (Apache 1.3.3) mod_perl 1.21 Apache::Session 1.03 The problem is most likely that you are alternating running Apache as root, normal users, and nobody. The problem is that once root create a semaphore block, nobody else can use it. If a user creates a semaphore block, nobody cannot use it. Rebooting removes all semaphore blocks and their permissions. When you get these errors, use ipcs and ipcrm (as root) to examine and fix your semaphores. -jwb
RE: Apache::Session -- Go Out of Scope!!!
You could try using a PerlCleanupHandler to kill any open locks. $r-register_cleanup( \clear_locks ); - Perrin Perrin, Thanks a lot. This worked great :-). Actually, as I say, I'm wrapping to Apache::Session with another object that handles cookies, expiration, etc. I just registered a cleanup sub within the constructor for that object. Looks like: Apache-request-register_cleanup(sub {$self-DESTROY; print STDERR "Destroyed the Object\n";}); Since we're inside the constructor and $self is already a reference to the object hash, the cleanup handler knows how to destroy this object. I couldn't achieve the same thing with a $SIG{__DIE__} = sub {...} because $main would then include a reference to the object. So in cases where the script did not die, the object would never go out of scope (because there's still an outstanding reference to it). Thanks again, Russ Russell Weiss Founder and Technical Manager InfoRelay Online Systems, Inc. http://www.InfoRelay.net/
Re: Apache::Session::DBI
On Thu, 30 Mar 2000 [EMAIL PROTECTED] wrote: Hi, I'm trying to use Apache::Session::DBI. I got the hang of it and started using it but I get the following error: [Thu Mar 30 04:41:41 2000] [error] Can't call method "store" on unblessed reference at lib/web/webmaster.p l line 54. Now, lines 49-54 on lib/web/webmaster.pl look like this (I added line numbers): 49 sub carry_on { 50 my $htdocs_dir = $SETUP::htdocs_dir; 51 my $p = $$query-param('p'); #which page user selected 52 my $do = $$query-param('do'); #which page user selected 53 $session-{'already_reged'} = 1; #so user can't submit this form ever again! 54 $session-store(); ... } Looks like you are using an ancient version of Apache::Session. I recommend upgrading to 1.0x. Even I don't remember how to use the old 0.1x version. -jwb Alot of other stuff come after this but it doesn't really matter :) Anyway, there's another routine, called main, that creates a session and then calls carry_on. Here's the routine with the two lines that come before it: package WEBMASTER; use strict; sub main { use vars qw($query $sid $session %session); #making these variables global local $query = \$MAIN::query; local ($sid,$session,%session); #session stuff my ($rc,$adv); #recommender, advertiser if (!$$query-param('sid')) { #make a fresh session for a first-time visitor my $opts = {'subclass-specific' = 'option overrides', 'autocommit' = '0', 'lifetime' = $SETUP::default_session_timeout}; $session = Apache::Session::DBI-new($opts); tie %session, 'Apache::Session::DBI', undef; #define variables $sid = $session-{'_ID'}; $rc = $$query-param('rc'); #recommender $adv = $$query-param('adv'); #advertiser #add to object $session-{'rc'} = $$query-param('rc'); $session-{'adv'} = $$query-param('adv'); $session-store(); } else { #get the session data for a returned visitor $sid = $$query-param('sid'); $session = Apache::Session::DBI-open($sid); tie %session, 'Apache::Session::DBI', $sid; #checking if session has timed-out $rc = $session-{'rc'}; #recommender $adv = $session-{'adv'}; #advertiser } carry_on(); } Well, this is about all of it. :) If I take off those two lines everything is working fine and the sessions is added to the database. Here's the complete error message from the error_log: Session manager opening persistent connection at /usr/local/lib/site_perl/Apache/Session/DBI.pm line 40. Apache::Session::DBI::init_connection() called at /usr/local/lib/site_perl/Apache/Session/DBI.pm l ine 206 Apache::Session::DBI::fetch('Apache::Session::DBI', '351d62cfe6f5895f') called at /usr/local/lib/s ite_perl/Apache/Session.pm line 61 Apache::Session::open('Apache::Session::DBI', '351d62cfe6f5895f') called at lib/web/webmaster.pl l ine 40 WEBMASTER::main called at (eval 34) line 88 Apache::ROOT::index_2epl::handler('Apache=SCALAR(0x82c6c78)') called at /usr/local/lib/site_perl/A pache/Registry.pm line 135 eval {...} called at /usr/local/lib/site_perl/Apache/Registry.pm line 135 Apache::Registry::handler('Apache=SCALAR(0x82c6c78)') called at lib/web/printing.pl line 0 eval {...} called at lib/web/printing.pl line 0 [Thu Mar 30 04:41:41 2000] [error] Can't call method "store" on unblessed reference at lib/web/webmaster.p l line 54.
Re: Apache::Session, DBD::Oracle
On Wed, 9 Feb 2000, Robert Locke wrote: We've been using the latest Apache::Session::DBI with some success using Oracle 8i (DBD::Oracle 1.03) as the data store. (Basically, we applied Ajit Deshpande's recommendation of patching DBIStore.pm with a large number for LongReadLen. See http:[EMAIL PROTECTED] for reference.) [...] To make a long story short, it seems that storing and then fetching a binary string is broken, but I'm not sure if this is an Oracle or DBD issue, or if I'm just doing something plain silly. It's my understanding that Oracle doesn't want you to use Long anymore. They prefer BLOB for this and are phasing out Long. Maybe they broke Long in the 8i release for certain situations. BLOB works fine from DBD::Oracle, so give it a try. You may need to set the type on the bind parameter to ORA_BLOB. perldoc DBD::Oracle for the scoop. - Perrin
Re: Apache::Session, DBD::Oracle
[EMAIL PROTECTED] (Robert Locke) writes: - store this string into Oracle (type is LONG) You really really don't want to be using LONG btw. How large is the data you're really storing anyways? Oracle can do varchars up to 2k unlike some other pesky databases. LONGs have a number of problems, you can't export/import them, you can't create table as select to copy them to a new table etc. They also allegedly make your tables slow to access, though I don't know the details. I don't know if BLOBs are any different though. I do wonder whether you're making good use of your database to be storing information as frozen perl data structures. It's flexible but it can't be very fast and it doesn't buy you the data mining abilities having a database is good for. -- greg
Apache::Session, DBD::Oracle
Hi, We've been using the latest Apache::Session::DBI with some success using Oracle 8i (DBD::Oracle 1.03) as the data store. (Basically, we applied Ajit Deshpande's recommendation of patching DBIStore.pm with a large number for LongReadLen. See http:[EMAIL PROTECTED] for reference.) We recently added some more data to our session hashes and everything broke. In trying to track the problem down, we've been able to replicate it OUTSIDE of Apache by writing a Perl script which simulates Apache::Session and does the following: - create a fairly large hash - convert it to a binary string using Storable::nfreeze - store this string into Oracle (type is LONG) - fetch string from the database - compare fetched string to the original string - convert fetched string back to a hash using Storable::thaw The above works great under our development environment, where we are using Oracle 8.0.5. But, in our production environment, where we are using Oracle 8i, the fetched string differs from the original and we cannot convert it back into the original hash. To make a long story short, it seems that storing and then fetching a binary string is broken, but I'm not sure if this is an Oracle or DBD issue, or if I'm just doing something plain silly. Any pointers would be appreciated. Thanks, Rob PS. I'm attaching the code as reference. teststore.pl
Anyone else have mod_perl and Apache::session httpd hangs on Solaris?
Hi, Apache::session is a wonderful product. Is there anyone successfully using Apache::session on solaris 2.7? Do to MY misuse, or solaris problem, my httpd hangs upon my mod_perl/Apache::session script request. I have traced the hang in my script to where I am issuing : tie %session 'Apache::session::File', $session_id, {NSems = 16}; Most of the time it works, BUT somtimes is just plan never returns, and the httpd process never goes away. When I try and stop/start the apache server, it says the the httpd process didn't accept the sigterm and then goes on to issue a kill -9 on the process. Is this some sort of locking problem? Keith - Original Message - From: William P. McGonigle [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, February 02, 2000 10:23 AM Subject: Re: XML Configuration [Was: Re: Caucho faster than mod_perl?] --- Matt Sergeant wrote: Would people prefer to setup mod_perl using some sort of XML configuration, because I might be interested in doing this, if there's interest. --- end of quote --- I can't say it'd add much to doing it by hand, but it'd probably make writing configuration assistants a whole lot easier, which would be a boon for mod_perl (I've setup mod_perl for so many otherwise-smart friends who just couldn't get it going). -Bill
Re: Anyone else have mod_perl and Apache::session httpd hangs on Solaris?
Hi again, P.S. I seem to have just duplicated the problem running JUST the example.perl script contained within the Apache::session distribution It occurs when you try to create a new session I am able to create a number of new sessions, and then on the 8th or 9th try, it hangs! This is the unmodified example.perl script (ok, I did have to do NSems=16, otherwise it didn't work at all on Solaris) Keith - Original Message - From: Keith Kwiatek [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 02, 2000 10:36 AM Subject: Anyone else have mod_perl and Apache::session httpd hangs on Solaris? Hi, Apache::session is a wonderful product. Is there anyone successfully using Apache::session on solaris 2.7? Do to MY misuse, or solaris problem, my httpd hangs upon my mod_perl/Apache::session script request. I have traced the hang in my script to where I am issuing : tie %session 'Apache::session::File', $session_id, {NSems = 16}; Most of the time it works, BUT somtimes is just plan never returns, and the httpd process never goes away. When I try and stop/start the apache server, it says the the httpd process didn't accept the sigterm and then goes on to issue a kill -9 on the process. Is this some sort of locking problem? Keith - Original Message - From: William P. McGonigle [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, February 02, 2000 10:23 AM Subject: Re: XML Configuration [Was: Re: Caucho faster than mod_perl?] --- Matt Sergeant wrote: Would people prefer to setup mod_perl using some sort of XML configuration, because I might be interested in doing this, if there's interest. --- end of quote --- I can't say it'd add much to doing it by hand, but it'd probably make writing configuration assistants a whole lot easier, which would be a boon for mod_perl (I've setup mod_perl for so many otherwise-smart friends who just couldn't get it going). -Bill
Re: Anyone else have mod_perl and Apache::session httpd hangs onSolaris?
Keith Kwiatek wrote: Hi again, P.S. I seem to have just duplicated the problem running JUST the example.perl script contained within the Apache::session distribution It occurs when you try to create a new session I am able to create a number of new sessions, and then on the 8th or 9th try, it hangs! This is the unmodified example.perl script (ok, I did have to do NSems=16, otherwise it didn't work at all on Solaris) How are you running it? Under Registry?
Re: Anyone else have mod_perl and Apache::session httpd hangs onSolaris?
On Wed, 2 Feb 2000, Keith Kwiatek wrote: Hi again, P.S. I seem to have just duplicated the problem running JUST the example.perl script contained within the Apache::session distribution It occurs when you try to create a new session I am able to create a number of new sessions, and then on the 8th or 9th try, it hangs! This is the unmodified example.perl script (ok, I did have to do NSems=16, otherwise it didn't work at all on Solaris) Keith I had the same problem, however putting in an explicit 'untie %session' when I have finished with the tied variable fixes the problem. My guess is that it is related to the session variable not going out of scope, so the destructor method in the Apache::Session class is not invoked. Although I could be wrong. Jason. --- Jason Ball Electronic Commerce Specialist Corporate Express Australia Ltd Phone: +61 2 9335 0374 Fax: +61 2 9335 0753 Email: [EMAIL PROTECTED]
Lingering processes --is it a mod_perl or Apache::session issue?
Hello, I have been using mod_perl with Apache::session... after doing development of a few cgi's I noticed that the apache server started spitting out "can't spawn another process" messages in the error log. When I stopped the apache server it listed about a million httpd processes that it said would not take a sigterm I am pretty sure I don't have any infinite loops, this are really basic scripts I am writting. I suspected it is some sort of deadlock with apache::sesssions (?). Has anyone else experienced this? Keith
Re: Apache::Session::DBI problems
Hello, On Wed, 19 Jan 2000, Kip Cranford wrote: I don't suppose it could be as simple as having a full disk? What does "df -k" report... I'm afraid not, no. Plenty of space is left on the drives. Regards, Mark. -- Mark Jewiss Knowledge Matters Limited http://www.knowledge.com
Re: Additions to the Apache::Session docs
Thanks Randy, I must make an Apache::Session FAQ. It would have this question and the one about semaphores on Solaris. I could make Apache::Session has a deep understanding of the data structure by having it compare the serialized hash before and after the session activity. I wonder if that would be too expensive... -Jeffrey Randy Harmon wrote: Unless someone wants to implement multi-level tied hashes (/arrays) to correct the following problem, something like the following should make it into the Apache::Session documentation. I hope it helps some folks. Randy --- When you store a hashref in a tied Apache::Session hash, subsequent accesses to that underlying sub-hash do not go through the Apache::Session tied-hash interface, and Apache::Session will not recognize that changes have been made (I suspect that similar direct access to a listref will behave the same way). The changes to Apache::Session to enable recognition of such accesses are non-trivial, particularly when multi-level hashes are desired. In order to force Apache::Session to recognize such a change, you may wish to access a scalar entry, such as by: $session{'fix_hashref_storage'}++;
Apache::Session::DBI problems
Hello, I'm trying to run a simple script using Apache::Session for the first time, and am having a few problems. Can't see anything relating to this in the documentation or the archives, so here goes... Whenever I run a script, everything works until I try to create a new session id, where I get the following error: No space left on device at /usr/local/libdata/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 46. This happens whether I use DBIStore or FileStore. I thought that this was just down to my scripts, so I've gone back to the example script included in the distribution. I get the same error when trying to run this. I'm sure this is a simple issue, but I just can't see the solution - any help would be greatly appreciated! Setup is as follows: OpenBSD 2.5 Apache 1.3.6 Latest version of mod_perl and Apache::Session Regards, Mark. -- Mark Jewiss Knowledge Matters Limited http://www.knowledge.com
Apache::Session, Embperl...
We are using Embperl 1.2, Apache Session 1.3 (using DBIStore/SysVSemaphoreLocker) with Oracle as the backend. We've been observing periodic browser hangs which can be sporadically replicated by hitting the same page in quick succession using the same session id. After doing that, updating %udat seems to cause the hang, perhaps the server process is waiting to acquire a write lock (?). Please note that we update the contents of %udat by calling a routine which exists in a separate module, something like: [- updateSession(\%udat); -] Are there any special considerations when doing something like that? Or is that plain silly? Sorry for the lack of detail. It's getting late in my part of the world. I will provide a more complete post tomorrow once we've had a chance to experiment some more. But in the meantime, any insights would be appreciated. Thanks, Rob PS. This seems related to a very recent post: "Apache::Session: hanging until alarm" (http://forum.swarthmore.edu/epigone/modperl/ningsmyplar) __ Get Your Private, Free Email at http://www.hotmail.com
RE: Apache::Session, Embperl...
We are using Embperl 1.2, Apache Session 1.3 (using DBIStore/SysVSemaphoreLocker) with Oracle as the backend. We've been observing periodic browser hangs which can be sporadically replicated by hitting the same page in quick succession using the same session id. After doing that, updating %udat seems to cause the hang, perhaps the server process is waiting to acquire a write lock (?). I guess this will be the reason. I never tried it, but maybe the ipcs utility can give some information about your semaphore when this occurs. Are there anything special happening before the hang (errors etc.)? Please note that we update the contents of %udat by calling a routine which exists in a separate module, something like: [- updateSession(\%udat); -] Are there any special considerations when doing something like that? Or is that plain silly? That's no problem and shouldn't have anything todo with your problem. Gerald - Gerald Richterecos electronic communication services gmbh Internetconnect * Webserver/-design/-datenbanken * Consulting Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925151 WWW:http://www.ecos.de Fax: +49 6133 925152 -
RE: Embperl + Apache::Session
I made a further test by now, with staticly linked mod_perl and without preloading HTML::Embperl in httpd.conf. If you staticly linked mod_perl you should preload Embperl, but it should also work without preloading. Doing a "tail -f /var/log/apache/error.log" I see "[11159]SES: Embperl Session management enabled (1.xx)" (with the number in brackets changing of course) every time I reload my testpage. That's ok But I can also still see the session-id changing with every reload, and no cookie is set, just like before. What do you mean by session id? The number inside the square bracktes id the pid of the Apache child. Or do you mean other things? Does the changing id not indicate that sessionmanagement is basically working and there is just something terribly wrong with the cookie part? Maybe I did not install some package from CPAN correctly (although I cannot remember seeing any error during installation)? I just searched for your initial mail and the module versions you metioned there should work just fine. Please try to include the following output in your test page: 1 = [+ ref (tied(%udat)) +] 2 = [+ ref (tied(%HTML::Embperl::udat)) +] 3 = [+ $Apache::Session::VERSION +] 4 = [+ $HTML::Embperl::Session::VERSION +] what is the output of this? Gerald - Gerald Richterecos electronic communication services gmbh Internetconnect * Webserver/-design/-datenbanken * Consulting Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925151 WWW:http://www.ecos.de Fax: +49 6133 925152 -
RE: Embperl + Apache::Session
But I can also still see the session-id changing with every reload, and no cookie is set, just like before. What do you mean by session id? The number inside the square bracktes id the pid of the Apache child. Or do you mean other things? I mean the ID saved as _session_id in %udat. I have a line "print %udat;" in my page to check if that number changes. ok, so this means that everytime there is a new session id generated. This is because the cookie is not comming thru. If everything is ok, the session id shouldn't change. Please try to include the following output in your test page: 1 = [+ ref (tied(%udat)) +] 2 = [+ ref (tied(%HTML::Embperl::udat)) +] 3 = [+ $Apache::Session::VERSION +] 4 = [+ $HTML::Embperl::Session::VERSION +] what is the output of this? 1 = HTML::Embperl::Session 2 = HTML::Embperl::Session 3 = 1.04 4 = 1.00 This looks also good, very strange. Does the "make test" of Embperl runs with all ok, for you? Could you send me your httpd.conf (private email)? Gerald
Re: Embperl + Apache::Session
On Sun, Jan 16, 2000 at 03:37:51PM +0100, Gerald Richter wrote: This looks ok for the Embperl part, but if you have now staticly linked mod_perl you should throw out the LoadModule perl_module . I don't know what Apache does, if a module is staticly and dynamicly present, but this doesn't seems to be a good idea... Wow, I don't believe it! It works now that I commented out the LoadModule line! At least it does so for requests with lynx and lwp-request, Netscape for some reason still does either not receive or accept the cookie, but that should be a minor issue now. Well, I think this is an unspecified if not even unreproducable behaviour of apache I ran into here because of my blindness ;-). Many thanks for your help, especially Geralds! Andre PGP signature
Apache::Session: hanging until alarm?
Hello! I've tried to use Apache::Session (with DBI and SysVSemaphoreLocker), and it failed. Many people replied me here that "Apache::Session is OK". I've set locking to NullLocker, and experienced data corruption. Well, I've put an alarm inside my handler, and it bangs over and over on the same place: === handler.pl == sub handler { my ($r) = @_; return -1 if $r-method !~ /^(GET|POST|HEAD)$/; return -1 if defined($r-content_type) $r-content_type !~ m|^text/|io; my ($port, $addr) = Socket::sockaddr_in($r-connection-local_addr); return -1 if $port == 8000; local $SIG{ALRM} = sub {Carp::confess "Alarm ";}; alarm 20; my %session; my $cookie = $r-header_in('Cookie'); $cookie =~ s/SESSION_ID=(\w*)/$1/; # Unless exists session_id, clean it! my $dbh = DBI-connect ("DBI:mysql:mail2pager", "*","*", { RaiseError = 1, PrintError = 1, AutoCommit = 1, } ); my $sth = $dbh-prepare_cached(q{ select id from sessions where id = ? }); $sth-execute($cookie); my $rses; $rses = $sth-fetchall_arrayref(); if (scalar @$rses == 0) { $cookie = undef; } tie %session, 'Apache::Session::DBI', $cookie, { DataSource = 'dbi:mysql:mail2pager', UserName = '*', Password = '*'}; $r-header_out("Set-Cookie" = "SESSION_ID=$session{_session_id};") if ( !$cookie ); # This creates a global called %session that is accessible in all components # Feel free to rename this as needed. # local *HTML::Mason::Commands::session = \%session; my $res = $ah-handle_request($r); # warn "\[$$\] Going to untie session $session{_session_id}\n"; # untie %HTML::Mason::Commands::session; alarm 2; untie %session; # warn "\[$$\] Session untied\n"; alarm 0; return $res; } === cut === It ALWAYS bangs like: [Sun Jan 16 22:02:41 2000] [error] Alarm at /usr/local/www/lib/handler.pl line 114 HTML::Mason::__ANON__('ALRM') called at /usr/libdata/perl/5.00503/mach/I PC/Semaphore.pm line 92 IPC::Semaphore::op('IPC::Semaphore=SCALAR(0x88eb6ac)', 15, 0, 4096, 31, 0, 4096, 31, ...) called at /usr/local/lib/perl5/site_perl/5.005/Apache/Session/ SysVSemaphoreLocker.pm line 69 Apache::Session::SysVSemaphoreLocker::acquire_write_lock('Apache::Sessio n::SysVSemaphoreLocker=HASH(0x87c9a84)', 'Apache::Session::DBI=HASH(0x8248a48)') called at /usr/local/lib/perl5/site_perl/5.005/Apache/Session.pm line 560 Apache::Session::acquire_write_lock('Apache::Session::DBI=HASH(0x8248a48 )') called at /usr/local/lib/perl5/site_perl/5.005/Apache/Session.pm line 478 Apache::Session::save('Apache::Session::DBI=HASH(0x8248a48)') called at /usr/local/lib/perl5/site_perl/5.005/Apache/Session.pm line 375 Apache::Session::TIEHASH('Apache::Session::DBI', undef, 'HASH(0x8ac3a64) ') called at /usr/local/www/lib/handler.pl line 136 HTML::Mason::handler('Apache=SCALAR(0x88eb79c)') called at /dev/null lin e 0 eval {...} called at /dev/null line 0 I.e. due to some reason write lock NEVER EVER gets aquired by handler. How do I debug the case? -- Alexander B. Povolotsky[ICQ 18277558] [2:5020/145][[EMAIL PROTECTED]]
Re: Embperl + Apache::Session
On Fri, Jan 14, 2000 at 07:00:13AM +0100, Gerald Richter wrote: You need to setup session handling at all, e.g. PerlSetEnv EMBPERL_SESSION_CLASSES "FileStore SysVSemaphoreLocker" That is PerlSetEnv EMBPERL_SESSION_CLASSES "FileStore NullLocker" in my httpd.conf When you restart your apache, you should see a message about EMbperl Session management enabled. Without this message it won't work You talk about this one, don't you? -- root@linbec31:/download/Perl/HTML-Embperl-1.2.1 # /etc/rc.d/init.d/httpd start [1392]SES: Embperl Session management enabled (1.xx) /etc/rc.d/init.d/httpd start: httpd started -- I saw that message every time since I started playing around with session handling, but despite the message it does not work You will only get the cookie header if you write to the %udat hash inside your page I have done this, using the sample page implementing a counter posted yesterday on this list. As I explained session management works as far as generating the id and saving it into %udat, but it simply does not set the cookie Since this happens on two machines with at least slightly different Linux distributions (one is Mandrake 6.0, the other a Redhat 5.2) I think it is a configuration problem... so if someone could please email me her complete configuration files I'd have more means to test Andre
RE: Embperl + Apache::Session
Since this happens on two machines with at least slightly different Linux distributions (one is Mandrake 6.0, the other a Redhat 5.2) I think it is a configuration problem... so if someone could please email me her complete configuration files I'd have more means to test What you describe looks good to me. There is one other issue, that is dynamlic linking mod_perl. How comes mod_perl into your Apache? Is it dynamicly loaded at runtime (i.e. by a LoadModule in your httpd.conf) or is it staticly loaded? If the first is true, look if Embperl is loaded somewhere in your httpd.conf (either by a PerlModule or by a file that is loaded with PerlRequire). Remove this. In case of dynamicly linking Embperl must not loaded at startup time. (mod_perl will do this at request time for you) Gerald - Gerald Richterecos electronic communication services gmbh Internetconnect * Webserver/-design/-datenbanken * Consulting Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925151 WWW:http://www.ecos.de Fax: +49 6133 925152 -
RE: Embperl + Apache::Session
PerlModule HTML::Embperl This line loads Embperl at startup, remove it! I could also build embperl staticly, maybe that helps. This will surly solve a lot of problems. But a quick try some minutes ago with just recompiling mod_perl with USE_DSO=0 and configuring apache with --disable_shared=perl was not successful. The configure script told me of mod_perl buildtype being OBJ, but I could not start the server afterwards because it complained about not knowing those PerlSetEnv and PerlModule lines above. Any ideas about that? Try to run Makefile.PL with the following parameters (change the directories of course): APACHE_SRC=/usr/src/packages/apache_1.3.9_mp/src USE_APACI=1 DO_HTTPD=1 APACHE_PREFIX=/usr/local/apache then type make and make install and you should have a new httpd in /usr/local/apache/bin Gerald
Re: Embperl + Apache::Session
On Fri, Jan 14, 2000 at 01:31:17PM +0100, Gerald Richter wrote: What you describe looks good to me. There is one other issue, that is dynamlic linking mod_perl. How comes mod_perl into your Apache? Is it dynamicly loaded at runtime (i.e. by a LoadModule in your httpd.conf) or is it staticly loaded? If the first is true, look if Embperl is loaded somewhere in your httpd.conf (either by a PerlModule or by a file that is loaded with PerlRequire). Remove this. In case of dynamicly linking Embperl must not loaded at startup time. (mod_perl will do this at request time for you) I made a further test by now, with staticly linked mod_perl and without preloading HTML::Embperl in httpd.conf. Doing a "tail -f /var/log/apache/error.log" I see "[11159]SES: Embperl Session management enabled (1.xx)" (with the number in brackets changing of course) every time I reload my testpage. But I can also still see the session-id changing with every reload, and no cookie is set, just like before. Does the changing id not indicate that sessionmanagement is basically working and there is just something terribly wrong with the cookie part? Maybe I did not install some package from CPAN correctly (although I cannot remember seeing any error during installation)? Andre PGP signature
Re: Embperl + Apache::Session
On Wed, Jan 12, 2000 at 11:12:53AM -0800, Cliff Rayman wrote: i am using embperl with cookies. i also have this set in httpd.conf PerlSetEnv EMBPERL_COOKIE_DOMAIN .genwax.com PerlSetEnv EMBPERL_COOKIE_PATH / PerlSetEnv EMBPERL_COOKIE_EXPIRES 'Friday, 31-Dec-2010 14:00:00 GMT' how are you checking to make sure cookies are sent? lwp-request -e 'http://www.domain.com/path/to/page/with/embperl|less You should see a SET-COOKIE header. I inserted those lines above into my httpd.conf, and did the lwp-request. All headers I do see are the following: Connection: close Date: Thu, 13 Jan 2000 14:39:53 GMT Server: Apache/1.3.9 (Unix) mod_perl/1.21 PHP/3.0.12 Content-Type: text/html Client-Date: Thu, 13 Jan 2000 14:39:53 GMT Client-Peer: 145.228.112.103:80 Title: sessiontest 1 Can you please send me a simple testpage for this, maybe I do something wrong in my embperl code... I have only begun with perl 6 weeks ago or so and I still have not understood all mystiques ;-) Take care, Andre
Apache::Session, AGAIN
Hello! I've just tried to work (again) with Apache::Session::DBI, and the following handler: # skipped sub handler { my ($r) = @_; return -1 if $r-method !~ /^(GET|POST|HEAD)$/; return -1 if defined($r-content_type) $r-content_type !~ m|^text/|io; my %session; my $cookie = $r-header_in('Cookie'); $cookie =~ s/SESSION_ID=(\w*)/$1/; # Unless exists session_id, clean it! my $dbh = DBI-connect ("DBI:mysql:mail2pager", "mine", "password", { RaiseError = 1, PrintError = 1, AutoCommit = 1, } ); my $sth = $dbh-prepare_cached(q{ select id from sessions where id = ? }); $sth-execute($cookie); my $rses; $rses = $sth-fetchall_arrayref(); if (scalar @$rses == 0) { $cookie = undef; } tie %session, 'Apache::Session::DBI', $cookie, { DataSource = 'dbi:mysql:mail2pager', UserName = 'tarkhil', Password = 'cypurcad'}; warn "\[$$\] Tied session $session{_session_id}\n"; $r-header_out("Set-Cookie" = "SESSION_ID=$session{_session_id};") if ( !$cookie ); # This creates a global called %session that is accessible in all components # Feel free to rename this as needed. # local *HTML::Mason::Commands::session = \%session; my $res = $ah-handle_request($r); warn "\[$$\] Going to untie session $session{_session_id}\n"; untie %HTML::Mason::Commands::session; untie %session; warn "\[$$\] Session untied\n"; return $res; } produced the following trace: [92525] Tied session c1e710ab3c0e64a2 [92525] Going to untie session c1e710ab3c0e64a2 ^^^ [92526] Tied session 8e38e48671c2d782 [92523] Going to untie session 4fc7720c37573e95 [92523] Session untied [92526] Going to untie session 8e38e48671c2d782 [92526] Session untied [92534] Tied session 0e9ffc7f9428baae [92534] Going to untie session 0e9ffc7f9428baae [92534] Session untied The session being untied by PID 92525 NEVER got untied. Does anyone have any ideas on that behaviour? -- Alexander B. Povolotsky[ICQ 18277558] [2:5020/145][[EMAIL PROTECTED]]
Re: Embperl + Apache::Session
i am using embperl with cookies. i also have this set in httpd.conf PerlSetEnv EMBPERL_COOKIE_DOMAIN .genwax.com PerlSetEnv EMBPERL_COOKIE_PATH / PerlSetEnv EMBPERL_COOKIE_EXPIRES 'Friday, 31-Dec-2010 14:00:00 GMT' how are you checking to make sure cookies are sent? either telnet directly to the port and do a get telnet www.domain.com 80 GET /path/to/page/with/embperl HTTP/1.0 that is two returns above, or better lwp-request -e 'http://www.domain.com/path/to/page/with/embperl|less You should see a SET-COOKIE header. cliff rayman genwax.com Andre Landwehr wrote: Hi, I am trying to use sessionmanagement via Apache::Session together with HTML::Embperl. As I understand from the documentation I just need to configure a storing and a locking mechanism in httpd.conf to do so. After that I should be able to use the %udat hash to store session related data, HTML::Embperl::Session is supposed to do everything from creating a unique session-id to storing it in a cookie or retrieving that cookie again automatically. Unfortunately setting the cookie does not work for me. When I use %udat for the first time a session-id is created (which I checked with a simple "print %udat;"), but the cookie is not sent (and: yes, my Netscape is cookie-enabled...). This is the embperl related stuff from my httpd.conf: -- AddType text/html .epl SetEnv EMBPERL_DEBUG 10477 SetEnv EMBPERL_VIRTLOG /perldebug SetEnv EMBPERL_ESCMODE 0 # optRawInput + optRedirectStdout SetEnv EMBPERL_OPTIONS 16914 # Session management PerlSetEnv EMBPERL_SESSION_CLASSES "MemoryStore NullLocker" PerlModule HTML::Embperl Location /perldebug SetHandler perl-script PerlHandler HTML::Embperl Options ExecCGI /Location Files *.epl SetHandler perl-script PerlHandler HTML::Embperl Options ExecCGI /Files --- I use the following versions: Apache_1.3.9 Apache-Session-1.04 HTML-Embperl-1.2.1 libwww-perl-5.43 URI-1.02 HTML-Parser-2.23 I would be happy if someone could help me with that since I have tried for two days everytime with the same result, which gets quite depressing by now ;-) Btw: To my mind Embperl is really great! I ported a site from PHP to Embperl recently and gained about 80% speed with that, due to faster database access Take care, Andre Part 1.2Type: application/pgp-signature
Mason + Apache::Session .. strange problems.
This will be posted to both the mod_perl and mason mailing lists. I'm tearing my hair out here. I'm using Apache::Session with Mason (snippet of calls to Apache::Session below). For some reason, when I hit certain pages with java applets (opencube scroller), and then do a browser "refresh" (IE5 and NS4.5) Apache::Session die()'s and posts: [Mon Jan 10 12:27:43 2000] [error] Object does not exist in the data store at /usr/local/lib/perl5/site_perl/5.005/Apache/Session/DBIStore.pm line 192. Which typically happens when you request a session id that's not in the store. A quick query reveals that the session is still there: mysql SELECT id, length FROM sessions WHERE id='48434f27feea873a'; +--++ | id | length | +--++ | 48434f27feea873a | 41 | +--++ 1 row in set (0.00 sec) Jumping to a page that pulls the cookie from the browser and spits it out shows that the cookie holds a new value (ie. bc7d790fa9f76185). Another query shows that it exists as well: mysql SELECT id, length FROM sessions WHERE id='bc7d790fa9f76185'; +--++ | id | length | +--++ | bc7d790fa9f76185 | 41 | +--++ 1 row in set (0.00 sec) From what I've found so far, I can query $session for my _session_id.. then if I request the cookie containing my session ID, I find that it is unset! So naturally, another session ID is set and I loose all the old data. So I have a couple questions here: How is my cookie getting "unset" / mangled? How can I tell which "Object does not exist in the data store" (ie. logging the session id in the error log)? What's the best way to debug this? ### Setting up sessions for mason my %session; my $cookie = $r-header_in('Cookie'); $cookie =~ s/SESSION_ID=(\w*)/$1/; tie %session, 'Apache::Session::DBI', $cookie, { DataSource = 'dbi:mysql:mydb', UserName = 'username', Password = 'password' }; $r-header_out("Set-Cookie" = "SESSION_ID=$session{_session_id};") if !$cookie ); local *HTML::Mason::Commands::session = \%session; $ah-handle_request($r); untie %HTML::Mason::Commands::session;
RE: Mason + Apache::Session .. strange problems.
I've got a few things to add.. I wrapped my tie in an eval so I can see what cookie is being set, etc. It's been a big help for debugging. This has helped me to discover that the scroller applet I'm using makes a query to a text file on the server.. so if I have a page w/ the scroller applet in it, two requests are made to the handler.. not just one (which makes sense). Ok.. scenario #1: I open a fresh browser and go to some generic page w/out the scroller in it.. session_id is set.. no problems. Then I go to the page with the scroller in it.. and still no problems. Everything is as I would expect it to be. The log file shows this when I load and refresh once: [Mon Jan 10 13:47:57 2000] [info] tie() successful: '' [Mon Jan 10 13:48:13 2000] [info] tie() successful: '4f6b9edbe40e0c2b' So the first line is request #1.. and the second line is the refresh. scenario #2: I open a fresh browser and go directly to the page with the scroller in it. The page comes up fine. When I refresh, the handler bombs. The log file shows this: [Mon Jan 10 13:50:43 2000] [info] tie() successful: '' [Mon Jan 10 13:50:47 2000] [info] tie() successful: '' [Mon Jan 10 13:51:54 2000] [error] tie() failed: 'Object does not exist in the data store at /usr/local/lib/perl5/site_perl/5.005/Apache/Session/DBIStore.pm line 192. ' panic: POPSTACK Callback called exit. So the first line is request #1.. the second line is the java applet requesting its file.. the third and all following lines are the result of a refresh. It looks like the java applet is causing the server to set a second cookie.. am I correct in assuming this? Ian
RE: Mason + Apache::Session .. strange problems.
It turns out that the java applet making another request for a page on the server was causing my cookie to be reset. Moving the file it was requesting out of mason's reach fixed the problem.
Additions to the Apache::Session docs
Unless someone wants to implement multi-level tied hashes (/arrays) to correct the following problem, something like the following should make it into the Apache::Session documentation. I hope it helps some folks. Randy --- When you store a hashref in a tied Apache::Session hash, subsequent accesses to that underlying sub-hash do not go through the Apache::Session tied-hash interface, and Apache::Session will not recognize that changes have been made (I suspect that similar direct access to a listref will behave the same way). The changes to Apache::Session to enable recognition of such accesses are non-trivial, particularly when multi-level hashes are desired. In order to force Apache::Session to recognize such a change, you may wish to access a scalar entry, such as by: $session{'fix_hashref_storage'}++;
Apache::Session::DBI on Solaris 2.6 woes
Hi there, For the last 2 months, I've been using Apache::Session::DBI on a Solaris 2.6 box (with the semaphorelocker nsems value set to 16) to store session information on a busy web site. Unfortunately, things seem to have gone awry, specifically with the tie: tie %SESSION, 'Apache::Session::DBI', $cookie, { DataSource = 'DBI:mysql:mydatabase', UserName = 'user', Password = 'pass' }; The connection to the database ties up a mySQL thread, and each time a session tie is called, the httpd daemon handling the request doesn't let go, so the mysql thread table gradually fills up to the maximum limit set. (Sorry for the horrible grammar) All other database connections for the site seem to work as normal. I'm running Apache 1.3.9, mod_perl 1.21, Apache::Session 1.03 and DBI 1.13. I've seen similar behaviour before when the tie to %SESSION was predeclared with "use vars qw /%SESSION/" rather than "my". I'm at a complete loss as to what might be going on, especially in the light of the development Linux box (running the same versions of everything as the Solaris box) working perfectly well. Does anyone have any ideas as to what might be wrong? Many thanks, Chris
Re: Apache::Session::DBIStore and Sybase
Mark D. Laundry wrote: dynamic PREPARE on IMAGE or TEXT datatypes" (sorry, don't have access to server right now). Try the following: Thanks a lot, seems to work - I was just going to modify it myself now. :) However, I decided to split the packages into two files - Session/DBI/Sybase.pm and Session/DBIStore/Sybase.pm, in order to use Embperl w/ DBIStore::Sybase SysVSemaphoreLocker (and move to DaemonLocker later when I deploy on several servers). Now all tests pass fine. Thanks again. Best Regards Vladimir
Apache::Session::DBIStore and Sybase
Hello, I've been trying to make Apache::Session::DBIStore (ver 1.04) work with Sybase. Unfortunately Sybase does not permit PREPARE statements to have IMAGE/TEXT datatypes (or at least I haven't found a way to make it work yet) and I get an error. Maybe someone is aware of solution to the problem above? The only I have in mind now is to change DBIStore to not use prepare with ?-style placeholders. Thanks in advance Vladimir
Re: Apache::Session::DBIStore and Sybase
Vladimir Ivaschenko wrote: Hello, I've been trying to make Apache::Session::DBIStore (ver 1.04) work with Sybase. Unfortunately Sybase does not permit PREPARE statements to have IMAGE/TEXT datatypes (or at least I haven't found a way to make it work yet) and I get an error. What error do you get? Post a code sample. We can't help if we can't see what what you're doing.
Re: Apache::Session::DBIStore and Sybase
Sat, Dec 04, 1999 at 09:34:07AM -0500 Mark D. Landry ÎÁÐÉÓÁÌ ÐÏ ÐÏ×ÏÄÕ Re: Apache::Session::DBIStore and Sybase Sybase. Unfortunately Sybase does not permit PREPARE statements to have IMAGE/TEXT datatypes (or at least I haven't found a way to make it work yet) and I get an error. What error do you get? Post a code sample. We can't help if we can't see what what you're doing. For example, "make test" from EmbPerl fails on mdatsess.htm, with error message (coming from server through Sybase's CT-Lib) close to "Cannot do dynamic PREPARE on IMAGE or TEXT datatypes" (sorry, don't have access to server right now). I made the following table in Sybase for holding session data: create table sessions ( id char(16) primary key, length decimal(11), a_session text ) I tried to be as close as possible to table structure recommended by DBIStore.pm documentation. -- Best Regards Vladimir Ivaschenko http://www.hazard.maks.net/~hazard
Embperl / Apache::Session bug?
Hi.. I'm trying to get session handling (%udat and %mdat) to work with embperl 1.2b11. I'm running stock redhat 6.1 on a p200; this comes with apache 1.3.9, mod_perl 1.21, and perl 5.00503. I installed embperl 1.2b11 and Apache::Session 1.04. I had previously installed and was using MySQL 3.22.27 with the latest version of DBI and DBD::mysql. Anyway, the symptoms are as follows: Everything works fine with embperl normally, but when I add the following lines to my srm.conf Bad Things Happen: PerlSetEnv EMBPERL_SESSION_CLASSES "DBIStore SysVSemaphoreLocker" PerlSetEnv EMBPERL_SESSION_ARGS "DataSource=dbi:mysql:session UserName=apache" The database exists, and the "sessions" table is set up as per the Apache::Session::DBIStore documentation. I performed a little bit of poking with strace and the single spawned child httpd seems to be sigsegv'ing right after it stats Embperl.pm and Embperl.bs, and before it attempts to open Embperl.. Here's a typical occurance: Filehandle 5 is open("/usr/lib/perl5/site_perl/5.005/i386-linux/HTML/Embperl.pm", O_RDONLY) = 5 Here's a cleaned-up version of what strace says about what's happening... (I've cleaned out the multitude of brk(3)'s and rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0). munmap(0x40215000, 4096)= 0 read(5, "isableHtmlScan = 512 ;\n"..., 4096) = 4096 read(5, "l \'use Apache::Constants qw(:com"..., 4096) = 4096 read(5, "lit (//, $info) ;\nmy $cnt ="..., 4096) = 4096 read(5, "e\'}= $ENV{EMBPERL_ESCMODE} }"..., 4096) = 4096 read(5, ": $@\" if ($@); \n\trequire CGI"..., 4096) = 4096 read(5, "\t{\n\tpush @cleanups, \'dbg"..., 4096) = 4096 read(5, "G \"i = $req{\'inputfile\'}\\n\" ;\n\n "..., 4096) = 4096 read(5, " {\n\tlocal(*ENTRY) = $val"..., 4096) = 4096 read(5, "\n\n$response = $ua-request($"..., 4096) = 4096 read(5, "= \\$HTML::Embperl::optDisabl"..., 4096) = 4096 read(5, "or $package\\:\\:$k - $caller\\n\" "..., 4096) = 4096 read(5, " $ok and $ok = $smtp-datas"..., 4096) = 1190 read(5, "", 4096) = 0 close(5)= 0 munmap(0x40017000, 4096)= 0 stat("/usr/lib/perl5/5.00503/i386-linux/auto/HTML/Embperl", 0xbfffd898) = -1 ENOENT (No such file or directory) stat("/usr/lib/perl5/5.00503/auto/HTML/Embperl", 0xbfffd898) = -1 ENOENT (No such file or directory) stat("/usr/lib/perl5/site_perl/5.005/i386-linux/auto/HTML/Embperl", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat("/usr/lib/perl5/site_perl/5.005/i386-linux/auto/HTML/Embperl/Embperl.so", {st_mode=S_IFREG|0555, st_size=145024, ...}) = 0 stat("/usr/lib/perl5/site_perl/5.005/i386-linux/auto/HTML/Embperl/Embperl.bs", {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 --- SIGSEGV (Segmentation fault) --- So it looks like it's reading embperl.pm, finishes with that, then stats those other files for some reason, then crashes. The exact same thing happens when those environment variables aren't set, but it continues to do the following stuff: stat("/usr/lib/perl5/site_perl/5.005/i386-linux/auto/HTML/Embperl/Embperl.bs", { st_mode=S_IFREG|0444, st_size=0, ...}) = 0 open("/usr/lib/perl5/site_perl/5.005/i386-linux/auto/HTML/Embperl/Embperl.so", O _RDONLY) = 5 fstat(5, {st_mode=S_IFREG|0555, st_size=145024, ...}) = 0 read(5, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320}\0"..., 4096) = 409 6 mmap(0, 130380, PROT_READ|PROT_EXEC, MAP_PRIVATE, 5, 0) = 0x40255000 mprotect(0x40271000, 15692, PROT_NONE) = 0 mmap(0x40271000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 5, 0x1b000) = 0x40271000 mmap(0x40274000, 3404, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40274000 close(5) and then it goes on to read and process the actual .epl source file. If it's producing a core file when it sigsegv's, I can't find what it did with it. Any thoughts?
RE: Embperl / Apache::Session bug?
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Aaron Elkiss Sent: Tuesday, November 16, 1999 4:46 PM To: [EMAIL PROTECTED] Subject: Embperl / Apache::Session bug? Hi.. I'm trying to get session handling (%udat and %mdat) to work with embperl 1.2b11. I'm running stock redhat 6.1 on a p200; this comes with apache 1.3.9, mod_perl 1.21, and perl 5.00503. I installed embperl 1.2b11 and Apache::Session 1.04. I had previously installed and was using MySQL 3.22.27 with the latest version of DBI and DBD::mysql. Anyway, the symptoms are as follows: Everything works fine with embperl normally, but when I add the following lines to my srm.conf Bad Things Happen: PerlSetEnv EMBPERL_SESSION_CLASSES "DBIStore SysVSemaphoreLocker" PerlSetEnv EMBPERL_SESSION_ARGS "DataSource=dbi:mysql:session UserName=apache" Did you load Embperl and/or Apache::Session at server startup time? Please try to _not_ load Embperl at startup time and load Apache::Session at startup time (e.g. PerlModule Apache::Session in your srm.conf) Gerald --- Gerald Richter ecos electronic communication services gmbh Internet - Infodatenbanken - Apache - Perl - mod_perl - Embperl E-Mail: [EMAIL PROTECTED] Tel:+49-6133/925151 WWW:http://www.ecos.de Fax:+49-6133/925152 ---
Re: Embperl / Apache::Session bug?
Preloading Apache::Session also causes sigsegv'ing, this time while dealing with MD5.pm. Preloading nothing seems to work. -aaron On Tue, Nov 16, 1999 at 05:00:31PM +0100, Gerald Richter [EMAIL PROTECTED] Gerald Richter muttered about RE: Embperl / Apache::Session bug?: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Aaron Elkiss Sent: Tuesday, November 16, 1999 4:46 PM To: [EMAIL PROTECTED] Subject: Embperl / Apache::Session bug? Hi.. I'm trying to get session handling (%udat and %mdat) to work with embperl 1.2b11. I'm running stock redhat 6.1 on a p200; this comes with apache 1.3.9, mod_perl 1.21, and perl 5.00503. I installed embperl 1.2b11 and Apache::Session 1.04. I had previously installed and was using MySQL 3.22.27 with the latest version of DBI and DBD::mysql. Anyway, the symptoms are as follows: Everything works fine with embperl normally, but when I add the following lines to my srm.conf Bad Things Happen: PerlSetEnv EMBPERL_SESSION_CLASSES "DBIStore SysVSemaphoreLocker" PerlSetEnv EMBPERL_SESSION_ARGS "DataSource=dbi:mysql:session UserName=apache" Did you load Embperl and/or Apache::Session at server startup time? Please try to _not_ load Embperl at startup time and load Apache::Session at startup time (e.g. PerlModule Apache::Session in your srm.conf) Gerald --- Gerald Richter ecos electronic communication services gmbh Internet - Infodatenbanken - Apache - Perl - mod_perl - Embperl E-Mail: [EMAIL PROTECTED] Tel:+49-6133/925151 WWW:http://www.ecos.de Fax:+49-6133/925152 ---
RE: Embperl / Apache::Session bug?
Preloading Apache::Session also causes sigsegv'ing, this time while dealing with MD5.pm. Preloading nothing seems to work. And Embperl is _not_ loaded at startup time? When does SIGSEGV occurs, when the server starts, on the first Embperl request or on the first request which uses %udat/%mdat? The problem is when mod_perl is build with USE_DSO. Maybe the compiler options does not match, for some of the modules (Perl, Apache, mod_perl, DBI etc.). Building a staticly linked Apache will surely solve the problem, but if you like to continue using the dynamic version, you can try the following two things: 1.) Preload HTML::Embperl::Session 2.) Try Apache::Session::FileStore instead of DBIStore Gerald - Gerald Richterecos electronic communication services gmbh Internetconnect * Webserver/-design/-datenbanken * Consulting Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925151 WWW:http://www.ecos.de Fax: +49 6133 925152 -
Re: Embperl / Apache::Session bug?
On Tue, Nov 16, 1999 at 07:43:38PM +0100, Gerald Richter [EMAIL PROTECTED] Gerald Richter muttered about RE: Embperl / Apache::Session bug?: Preloading Apache::Session also causes sigsegv'ing, this time while dealing with MD5.pm. Preloading nothing seems to work. And Embperl is _not_ loaded at startup time? Correct. When does SIGSEGV occurs, when the server starts, on the first Embperl request or on the first request which uses %udat/%mdat? SIGSEGV always occurs when the server starts. The problem is when mod_perl is build with USE_DSO. Maybe the compiler options does not match, for some of the modules (Perl, Apache, mod_perl, DBI etc.). This seems likely, as the mod_perl and apache were installed from RPMs. When embperl was built, the headers I used were from an install of the apache SRPM. I will try rebuilding apache, mod_perl, apache::session, and embperl from pristine source and see what happens. Building a staticly linked Apache will surely solve the problem, but if you like to continue using the dynamic version, you can try the following two things: 1.) Preload HTML::Embperl::Session SIGSEGV's when dealing with MD5.so. 2.) Try Apache::Session::FileStore instead of DBIStore I'll try this later as well. Gerald Thanks for your help, -aaron
Apache::Session Locking
"Kimbro" == Kimbro Staken writes: Kimbro I'm trying to setup Apache::Session under Embperl with a MySQL Kimbro datastore. I have multiple machines that will be serving the site thus Kimbro all machines will access the datastore. In the documentation it says to Kimbro use the DBIStore with a DaemonLocker which is fine. However there seems Kimbro to be no documentation on how to use the DeamonLocker. I see it is Well, I've ended up using NullLocker. I still don't understand how Apache::Session could work. Any lock-releasing is done ONLY in DESTROY method, and while it should perform excellently in CGIs, I wonder how locks ever gets released in mod_perl environment... -- Alexander B. Povolotsky[ICQ 18277558] [2:5020/145][[EMAIL PROTECTED]]
Apache::Session Locking
I'm trying to setup Apache::Session under Embperl with a MySQL datastore. I have multiple machines that will be serving the site thus all machines will access the datastore. In the documentation it says to use the DBIStore with a DaemonLocker which is fine. However there seems to be no documentation on how to use the DeamonLocker. I see it is opening a port to connect to a process but no where do I see what the process it connects to should be. Does anyone know what the process is that it needs to connect to? Is locking even necessary when using MySQL since MySQL provides its own syncronization? Thanks -- Kimbro Staken Chief Technology Officer Infostreet Inc.
Re: Apache::Session and File Upload (Was: Apache::Session hangs script)
Kip Cranford wrote: Again, I'm using mod_perl 1.21, apache 1.3.9, Apache::Session 1.03, on a RedHat 6 linux system with perl 5.005_03, and am using Netscape Comm. 4.51 as my browser. The problem now seems to be Apache::Session and file uploads. My handler is providing a simple file upload interface, and I'm using Apache::Session to keep track of filenames, content types, sizes, etc. Using a very simple script, in which I store only a single scalar variable in my session, and using the "multipart/form-data" encoding type on my form, I can get the script to hang every time. It _always_ hangs in the same place in the "op" function: DB1 IPC::Semaphore::op(/usr/lib/perl5/5.00503/IPC/Semaphore.pm:90): 90: croak 'Bad arg count' if @_ % 3; DB1 IPC::Semaphore::op(/usr/lib/perl5/5.00503/IPC/Semaphore.pm:91): 91: my $data = pack("s*",@_); DB1 IPC::Semaphore::op(/usr/lib/perl5/5.00503/IPC/Semaphore.pm:92): 92: semop($$self,$data); The problem is that you are leaking session handles. For Apache::Session to work, there must be zero references to the session hash at the end of the request. -jwb -- Jeffrey W. Baker * [EMAIL PROTECTED] Critical Path, Inc. * we handle the world's email * www.cp.net 415.808.8807
Re: Apache::Session and File Upload (Was: Apache::Session hangs script)
Thanks for the reply, Jeffrey. Ok, I can understand how leaking session handles would cause a read or write lock, or whatever. However, I thought that untieing the session hash would release whatever locks the session held -- at the end of the simple script I untie the hash. In fact, the script is so simple I don't see where I could be leaking the handles (but just because _I_ can't see where doesn't mean a whole lot :) And finally, to add to my confusion, I can take the test script, change the form encoding from multipart to x-www-form-urlencoded, and have it work fine. Change it back to multipart, and it hangs. Any idea there?? Thanks for your attention, --kip p.s. I'm including the test script at the end of this message -- there's probably something obviously wrong that I just can't see... The problem is that you are leaking session handles. For Apache::Session to work, there must be zero references to the session hash at the end of the request. -jwb -- Jeffrey W. Baker * [EMAIL PROTECTED] Critical Path, Inc. * we handle the world's email * www.cp.net 415.808.8807 Test Script use strict; use Apache (); use Apache::Constants qw( :common ); use Apache::Session::DBI; use CGI(); sub handler { my $r = shift; $r-send_http_header("text/html"); my $session_id = CGI::param('session') || undef; my %session; my $opts = { DataSource = 'dbi:mysql:sessions', UserName= 'nobody', Password= '', }; tie %session, 'Apache::Session::DBI', $session_id, $opts; my $file = CGI::param('upload'); if ($file) { $session{'file'} = $file; } print__EOS__; Apache::Session Test Scriptbr Session ID number is: $session{_session_id}br Storing file: $filebr br form action="http://xxx/secure" enctype="multipart/form-data" method="post" !--form action="http://xxx/secure" method="post"-- Type in your name here: input type="file" name="upload"br input type="submit" value="Go!" input type="hidden" name="session" value="$session{_session_id}" /form __EOS__ print "untieing the session...br"; untie %session; } 1; === End Test Script ===
Re: eval'ed Apache::Session tie panics with POPSTACK?
Tobias Hoellrich wrote: I wanted to trap non-existant session-id's by bracketing the tie %{$href}, 'Apache::Session::DBI', $id, { DataSource = 'dbi:mysql:sessions', UserName = 'db_user', Password = 'db_passwd' }; with an eval { }; block. Once I've done this and send a non-existant session-id I get the following in my error_log: panic: POPSTACK Callback called exit. This is a bug in perl, caused by Carp::croak being called inside eval. It's fixed in 5.005_62, but you might not want to go to a development version. Unfortunately, I've never used Apache::Session, so I don't know how you can avoid the call to croak. -- Peter Haworth [EMAIL PROTECTED] "I think that's very legible. If you don't, you need to read more perl." -- Tom Christiansen
Apache::Session hangs script
I'm using Apache/1.3.9 (Unix), mod_perl/1.21, Apache-Session-1.03, with MySQL 3.22.25. I'm using the the Apache::Session::DBI module with MySQL to provide some simple session management. I'm running the script as a PerlHandler... I'm storing the session ID as a hidden variable, which I retrieve on subsequent calls to the script, and use it to re-open the session object as described in the Apache::Session doc. 1 or 2 calls _after_ the intial invocation of the script, my browser hangs. Using the debugger, I've found where it seems to get hung up -- see below. Is this some sort of lock blocking, or stale lock or something? Any help would be appreciated. Thanks, --kip =-=-=-=-=-=-=-= Debugging Output =-=-=-=-=-=-=-= DB1 s Apache::Session::SysVSemaphoreLocker::acquire_read_lock(/usr/lib/perl5/site_perl/5.005/Apache/Session/SysVSemaphoreLocker.pm:50): 50: $self-{sem}-op($self-{read_sem} + $self-{nsems}/2, 0, SEM_UNDO, 51: $self-{read_sem},1, SEM_UNDO); DB1 s IPC::SysV::SEM_UNDO(/usr/lib/perl5/5.00503/IPC/SysV.pm:65535): 65535: DB1 s IPC::SysV::SEM_UNDO(/usr/lib/perl5/5.00503/IPC/SysV.pm:65535): 65535: DB1 s IPC::Semaphore::op(/usr/lib/perl5/5.00503/IPC/Semaphore.pm:88): 88: @_ = 4 || croak '$sem-op( OPLIST )'; DB1 s IPC::Semaphore::op(/usr/lib/perl5/5.00503/IPC/Semaphore.pm:89): 89: my $self = shift; DB1 s IPC::Semaphore::op(/usr/lib/perl5/5.00503/IPC/Semaphore.pm:90): 90: croak 'Bad arg count' if @_ % 3; DB1 s IPC::Semaphore::op(/usr/lib/perl5/5.00503/IPC/Semaphore.pm:91): 91: my $data = pack("s*",@_); DB1 s IPC::Semaphore::op(/usr/lib/perl5/5.00503/IPC/Semaphore.pm:92): 92: semop($$self,$data); DB1 s /\ | | ---| Hangs Here...
eval'ed Apache::Session tie panics with POPSTACK?
I wanted to trap non-existant session-id's by bracketing the tie %{$href}, 'Apache::Session::DBI', $id, { DataSource = 'dbi:mysql:sessions', UserName = 'db_user', Password = 'db_passwd' }; with an eval { }; block. Once I've done this and send a non-existant session-id I get the following in my error_log: panic: POPSTACK Callback called exit. Without the eval around the tie the script dies with: [Tue Oct 19 16:55:09 1999] [error] Object does not exist in the data store at /usr/local2/lib/perl5/si te_perl/5.005/Apache/Session/DBIStore.pm line 192. So, do I have to look check the database myself for the session-id? Should I modify DBIStore.pm to not die, but do something else? Is this related to: http://x31.deja.com/getdoc.xp?AN=536753692CONTEXT=940379169.1854472193hitn um=1 Cheers Tobias
Apache::Session::DBI and PostgreSQL
Hi all, I'm trying out Apache::Session for the first time, with this bit of code adapted from the manual: #!/usr/bin/perl -w use strict; #use Apache::Session::File; use Apache::Session::DBI; my %session; #make a fresh session for a first-time visitor #tie %session, "Apache::Session::File", undef, #{ Directory = "/tmp/sessiondata" }; tie %session, "Apache::Session::DBI", undef, {DataSource = 'DBI:Pg:dbname=sessions', #these arguments are UserName = '', #required when using Password = ''#DBIStore.pm }; #stick some stuff in it $session{visa_number} = "1234 5678 9876 5432"; #get the session id for later use my $id = $session{_session_id}; print "Content-type: text/html\n\n"; print $id; But when I run this script, inside the /perl directory handled by Apache::Registry, the httpd process dies, and error_log reports: [Sun Oct 17 21:40:06 1999] [error] (in cleanup) DBD::Pg::st execute failed: ERROR: parser: parse error at or near "" panic: POPSTACK Callback called exit. Note, Apache::Session::File works fine, and I have no problem with DBI and DBD::pg on this system. Thanks for any advice, ---m -- [EMAIL PROTECTED]Miguel "Migs" A.L. Paraz http://www.iphil.netIPhil Communications Network, Inc. +63-2-750-2288Business Development Group
Re: Apache::Session and auto-expiration
Folks, My apologies and please disregard my previous post. I just realized (with help from Andy Pruitt) that what I saw were the remnants of the old Apache::Session. The new Apache::Session doesn't implement auto-expiration. Sorry for the mixup. Dmitry At 02:13 PM 10/13/99 , Dmitry Beransky wrote: Hi, I've been trying to figure out how auto-expiration works in the new version on Apache::Session. After going through the code of IPC.pm, I think I got the idea, but still it would be nice if this was documented somewhere. I don't think it is. Is it?
Apache::Session. Why Apache? Why Session?
I've been going through the code of Apache::Session trying to understand how it works and how to use it when it occurred to me that the module doesn't really measure up to it's name. I mean IMHO, the name is a bit misleading. First. It looks like the module's code is completely self-contained and doesn't depend on anything Apache. If my observations are true, why is it in the Apache hierarchy (except possibly for historical reasons)? Second. It doesn't really manage sessions. It provides implementations for different models of persistent storage (memory, FS, DB, etc.). A complete Apache-based session managing mechanism (with session initialization, destruction, auto-expiration, etc.) still has to be coded on top of it. Any comments? Shouldn't it be renamed? Regards Dmitry Beransky
RE: Apache::Session
I would appreciate if anybody succesfully using either Apache::Session::File or Apache::Session::File could paste in the lines they used in their Apache configuration files to initialize Apache::Session -- I have only been able to use Apache::Session 0.17 but now that Embperl has been updated to work with newer versions, I would like to be able to get the new Session modules to work as well, but they don't seem to with my existing initialization lines in Apache. Download Apache::Session 1.04 and Embperl 1.2b10 from ftp://ftp.dev.ecos.de/pub/perl/embperl/ and put the following in your httpd conf: PerlSetEnv EMBPERL_SESSION_CLASSES "FileStore SysVSemaphoreLocker" PerlSetEnv EMBPERL_SESSION_ARGS "Diretory=/tmp/sessions" PerlModule Apache::Session::Embperl PerlModule HTML::Embperl Set the directory to whatever you like and where your httpd has write permissions Gerald --- Gerald Richter ecos electronic communication services gmbh Internet - Infodatenbanken - Apache - Perl - mod_perl - Embperl E-Mail: [EMAIL PROTECTED] Tel:+49-6133/925151 WWW:http://www.ecos.de Fax:+49-6133/925152 ---
RE: Embperl and Apache::Session (was: Installation problem whith Embperl)
I tried to install HTML::Embperl with Apache/mod_perl on a Sparc/Solaris server, but 'make test' failed with an error on the module Apache/Session/Win32.pm. Did someone already encounter/solve this kind of problem ? 1) My config is: OS = Solaris apache V1.3.9 mod_perl V1.21 Apache::Session V1.03 Perl V5.00503 Embperl V1.2b8 Apache::Session 1.03 is errornous! Use either Apache::Session 1.02 or upgrade to Embperl 1.2b10 and use Apache::Session 1.04. Both Apache::Session version are avialable form ftp://ftp.dev.ecos.de/pub/perl/embperl/ I hope Jeffery will put Apache::Session 1.04 soon on CPAN so these confusion will have an end. Gerald --- Gerald Richter ecos electronic communication services gmbh Internet - Infodatenbanken - Apache - Perl - mod_perl - Embperl E-Mail: [EMAIL PROTECTED] Tel:+49-6133/925151 WWW:http://www.ecos.de Fax:+49-6133/925152 ---
problem with Embperl and Apache::Session::File
Folks, I'm running: Solaris 2.6 Perl 5.005_03 Apache-Session-1.04 HTML_Embperl-1.2b10 and I'm trying to use Apache::Session::File ... I have this test program: #!/usr/local/perl5.005_03/perl use Apache; use Apache::Session::File; my $id = 1; my $opts = { Directory =gt; '/tmp' }; my %session; tie %session,'Apache::Session::File', $id, $opts; print Content-type: text/plain\n\n; if ($session{data} eq '') { print "first time"; } else { print "not first time"; } $session{data} = 'x'; untie(%session); exit; and am getting this error message: Invalid argument at /usr/local/perl5.005_03/lib/site_perl/5.005/Apache/Session/SysVSemaphoreLocker.pm line 46. Anyone know why this is happening? Thanks for your help, Dave Saunders [EMAIL PROTECTED]
Re: problem with Embperl and Apache::Session::File
"David R. Saunders" wrote: Folks, I'm running: Solaris 2.6 Perl 5.005_03 Apache-Session-1.04 HTML_Embperl-1.2b10 and I'm trying to use Apache::Session::File ... I have this test program: #!/usr/local/perl5.005_03/perl use Apache; use Apache::Session::File; my $id = 1; my $opts = { Directory =gt; '/tmp' }; my $opts = { Directory = '/tmp', NSems = 16 }; -jwb
Re: Installation Problem with Apache::Session and Mason
[EMAIL PROTECTED] wrote: I'm having a problem setting up Apache::Session on one machine and not another, and I'm hoping that someone will recognize what I'm doing wrong. I'm using Mason to make the connection to the package when Apache starts up. On the problem server, the following happens on server start-up: starting httpd... Ambiguous use of read = resolved to "read" = at /usr/lib/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 35. Ambiguous use of write = resolved to "write" = at /usr/lib/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 35. Ambiguous use of {read} resolved to {"read"} at /usr/lib/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 43. Ambiguous use of {write} resolved to {"write"} at /usr/lib/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 44. Ambiguous use of {read} resolved to {"read"} at /usr/lib/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 54. Ambiguous use of {write} resolved to {"write"} at /usr/lib/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 61. Ambiguous use of {read} resolved to {"read"} at /usr/lib/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 68. Ambiguous use of {write} resolved to {"write"} at /usr/lib/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 74. Ambiguous use of {read} resolved to {"read"} at /usr/lib/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 81. Ambiguous use of {read} resolved to {"read"} at /usr/lib/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 85. Ambiguous use of {write} resolved to {"write"} at /usr/lib/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 92. Ambiguous use of {write} resolved to {"write"} at /usr/lib/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 96. Ambiguous use of {read} resolved to {"read"} at /usr/lib/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 103. Ambiguous use of {write} resolved to {"write"} at /usr/lib/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 106. Ambiguous use of {read} resolved to {"read"} at /usr/lib/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 110. Ambiguous use of {write} resolved to {"write"} at /usr/lib/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 111. That is Perl being anal about the use of unquoted read and write as hash keys. I should probably fix this but it isn't fatal. The server does start, however. But when I try to access a page that uses the session hash, the following appears in the httpd error log: [Thu Nov 4 11:17:21 1999] [error] Permission denied at /usr/lib/perl5/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 64. This is a different problem. At some point someone other than the user that your httpd runs as created the semaphore block that you are tyring to use. First, consult the ipcs and ipcrm man pages. Then, as root, remove the semaphore block that is causing the problem and allow the httpd to recreate it as the nobody user. -jwb I've checked the permissions on the module itself, the directory where the session files are stored, and the permissions of the owner of the httpd process. I've had no problem on another server, also running Linux 2.0.35. All the corresponding PERL modules seem synched, as well as the Apache httpd binaries. Here is the script that is called (part of Mason's start up script called handler.pl): # This block of code can be enabled to create a session-hash that every # component can access. This is useful for maintaining state across # multiple requests. The Apache::Session module is required. # my %session; my $cookie = $r-header_in('Cookie'); $cookie =~ s/SESSION_ID=(\w*)/$1/; tie %session, 'Apache::Session::File', $cookie, {'Directory' = '/tmp/session'}; $r-header_out("Set-Cookie" = "SESSION_ID=$session{_session_id};") if ( !$cookie ); # This creates a global called %session that is accessible in all components. # Feel free to rename this as needed. # local *HTML::Mason::Commands::session = \%session; $ah-handle_request($r); untie %HTML::Mason::Commands::session; This is Apache-Session-1.03 and HTML-Mason-0.72 on Apache 1.3.6. Thanks for any help/hints you can provide. Marc Kelly [EMAIL PROTECTED] -- Jeffrey W. Baker * [EMAIL PROTECTED] Critical Path, Inc. * we handle the world's email * www.cp.net 415.808.8807
Apache::Session hangs script
"Kip" == Kip Cranford writes: Kip I'm using Apache/1.3.9 (Unix), mod_perl/1.21, Apache-Session-1.03, with Kip MySQL 3.22.25. I'm using the the Apache::Session::DBI module with MySQL Kip to provide some simple session management. I'm running the script as a Kip PerlHandler... Kip Apache::Session::SysVSemaphoreLocker::acquire_read_lock(/usr/lib/perl5/site_perl/5.005/Apache/Session/SysVSemaphoreLocker.pm:50): Kip 50: $self-{sem}-op($self-{read_sem} + $self-{nsems}/2, 0, Yes, I know, I've posted it here before. For some people (are you using FreeBSD?) Apache::Session blocks forever after first usage. I've reported it to the list, but no one helped. I've ended up using dummy locking :-( -- Alexander B. Povolotsky[ICQ 18277558] [2:5020/145][[EMAIL PROTECTED]]