Re: [studs-user] Truncated WEB-INF/work/ServletContext.ser
Status: Beta
Brought to you by:
mojavelinux
|
From: Dan A. <dan...@gm...> - 2005-07-31 13:30:05
|
On 7/28/05, Johan Mj=F6nes <joh...@on...> wrote: > Hi all! >=20 > I've noticed that WEB-INF/work/ServletContext.ser file sometimes gets > truncated to zero bytes, but still exists. >=20 > This results in the following error: >=20 > : Fatal error: Call to a member function getStartup() on a non-object in = C:\develsoft\Apache Group\Apache2\htdocs\basic\WEB-INF\lib\stratus\connecto= r\HttpProcessor.php on line 80 > at .RootException(C:\develsoft\Apache Group\Apache2\htdocs\basic\= WEB-INF\lib\horizon\lang\RootException.php:67) > at .fatalErrorWatchdog(C:\develsoft\Apache Group\Apache2\htdocs\b= asic\WEB-INF\lib\stratus\connector\HttpProcessor.php:328) > at [PHP].main(:) >=20 > context is now of type bool (and is false since an eval() of a zero lengt= h string will return false). ContextConfig does some minor validity checkin= g (if context is null), but it should really verify that the object was pro= perly loaded. Also, if object is not properly loaded, I don't throwing an e= xception is exciting is really what you want. Log it and then try to recrea= te the Context (by reloading the configuration). >=20 > What do you think? :) >=20 > However, this isn't the problem. The problem is WHY this file gets trunca= ted? I haven't done any major investigation so far, I wanted to see if you = had any suggestions or ideas first. >=20 > Best Regards, >=20 > Johan >=20 Okay, first a few questions. What platform are you running (I know it is some variant of windows) and what is the file system. Clearly this functionality is working fine on Linux because the demo application has never become corrupted and it is hit in parallel quite often. It feels to me like a file locking issue. In general, the servlet context is written by: open file in append mode lock truncate unlock close I have added a couple of santiy checks in the code. First, if ServletContext.ser is empty, I treat it as non-existing. If the lock fails, then I don't write the servlet context. Finally, I do a check for a valid StandardContext object rather than null. However, if the StandardContext is not valid, I do throw an exception rather than loading a new version. I figured if the ServletContext.ser file has invalid data, we should not treat that as okay, but rather throw an exception since we need to depend on that file as being valid for smoooth operation of the application. If the problem is with locking, what I suggest is that you run a little test script (actually two scripts) that test basic file locking on your platform and see if that works. If it doesn't, perhaps we need to use a more generic form of file locking in Studs. /dan --=20 Open Source Advocacy http://www.mojavelinux.com |