DO NOT REPLY [Bug 18479] - HttpSessionBindingListener.valueUnbound() not called

2004-04-27 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=18479.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=18479

HttpSessionBindingListener.valueUnbound() not called





--- Additional Comments From [EMAIL PROTECTED]  2004-04-27 18:08 ---
Thanks Remy, that sovled the issue!  The listeners are no longer null so the
attributeRemoved() method of my HttpSessionAttributeListener is now successfully
called as expected.

Jake

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 18479] - HttpSessionBindingListener.valueUnbound() not called

2004-04-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=18479.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=18479

HttpSessionBindingListener.valueUnbound() not called

[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution||FIXED



--- Additional Comments From [EMAIL PROTECTED]  2004-04-25 10:39 ---
I committed a change which may fix this. Either this fixes it or it will not be
fixed since (unless you submit a tested patch) I don't see the issue as very
important.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 18479] - HttpSessionBindingListener.valueUnbound() not called

2004-04-19 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=18479.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=18479

HttpSessionBindingListener.valueUnbound() not called

[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
Product|Tomcat 4|Tomcat 5
 Resolution|FIXED   |
Version|4.1.18  |5.0.19



--- Additional Comments From [EMAIL PROTECTED]  2004-04-19 12:22 ---
I think Jacob is right cause I have a similiar problem:

Using Tomcat 5.0.19 I call the function invalidate() to destroy the session. 
There is a Listener but the method valueUnbound() is not called.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 18479] - HttpSessionBindingListener.valueUnbound() not called

2004-04-15 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=18479.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=18479

HttpSessionBindingListener.valueUnbound() not called





--- Additional Comments From [EMAIL PROTECTED]  2004-04-16 01:48 ---
Just to be clear, the listeners are null only when Tomcat is removing
non-serializable attributes.  Listeners exist (as they should) when attributes
are removed during normal session expiration.  And valueUnbound() always works
just fine.  So, the bug here is to make sure HttpSessionAttributeListeners get
called in cases where the attribue is being removed because the attribute's
value isn't serializable.

Jake

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 18479] - HttpSessionBindingListener.valueUnbound() not called

2004-04-13 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=18479.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=18479

HttpSessionBindingListener.valueUnbound() not called





--- Additional Comments From [EMAIL PROTECTED]  2004-04-13 09:44 ---
The sessionDestroyed timing problem is what the 2.3 specification mandated (this
was a mistake obviously), so you cannot have something portable between 2.3 and
2.4 here.

valueUnbound is, as far as I can see, correctly called after the value is no
longer available through getAttribute.

In setAttribute:
// Replace or add this attribute
Object unbound = attributes.put(name, value);

// Call the valueUnbound() method if necessary
if ((unbound != null) 
(unbound instanceof HttpSessionBindingListener)) {
try {
((HttpSessionBindingListener) unbound).valueUnbound
(new HttpSessionBindingEvent(this, name));
} catch (Throwable t) {
log(sm.getString(standardSession.bindingEvent), t);
}
}

In removeAttribute:
// Remove this attribute from our collection
Object value = attributes.remove(name);

// Do we need to do valueUnbound() and attributeRemoved() notification?
if (!notify || (value == null)) {
return;
}

// Call the valueUnbound() method if necessary
HttpSessionBindingEvent event = null;
if (value instanceof HttpSessionBindingListener) {
event = new HttpSessionBindingEvent(this, name, value);
((HttpSessionBindingListener) value).valueUnbound(event);
}

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DO NOT REPLY [Bug 18479] - HttpSessionBindingListener.valueUnbound() not called

2004-04-13 Thread Jess Holle
[EMAIL PROTECTED] wrote:

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=18479.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=18479

HttpSessionBindingListener.valueUnbound() not called

--- Additional Comments From [EMAIL PROTECTED]  2004-04-13 09:44 ---
The sessionDestroyed timing problem is what the 2.3 specification mandated (this
was a mistake obviously), so you cannot have something portable between 2.3 and
2.4 here.
 

[Replying on mailing list as Bugzilla is down.]

Actually you can -- but you have to check the servlet engine spec 
version and have different logic branches for each version.

It's ugly, but it is doable.

--
Jess Holle
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


DO NOT REPLY [Bug 18479] - HttpSessionBindingListener.valueUnbound() not called

2004-04-13 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=18479.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=18479

HttpSessionBindingListener.valueUnbound() not called





--- Additional Comments From [EMAIL PROTECTED]  2004-04-14 05:50 ---
Hi Remy,

You are right.  valueUnbound() *is* being called.  The problem is, my registered
SessionAttributeListener isn't being called (and yes, it is registered.  I get
println() output from attributeAdded()).  I added some println() statements to
StandardSession to see what was going on and I found something weird; The
listeners[] array is null.

Here's my debugging output...

Apr 14, 2004 12:23:48 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
JRK... key being removed: KILLER_HELPER
JRK... instance of HttpSessionBindingListener? true
ServletContainerListener.valueUnbound() called!
JRK... listeners are: null
Apr 14, 2004 12:23:48 AM org.apache.catalina.logger.LoggerBase stop
INFO: unregistering logger Catalina:type=Logger,path=/picoservlet,host=localhost


So, it makes sense that I wasn't seeing the println() statements in my
attributeRemoved() method since the following code in
StandardSession.removeAttributeInternal() can't find the listeners...

Context context = (Context) manager.getContainer();
Object listeners[] = context.getApplicationEventListeners();


Here's a patch showing where I added the debugging lines resulting in the above
output...

Index: catalina/src/share/org/apache/catalina/session/StandardSession.java
===
RCS file:
/home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardSession.java,v
retrieving revision 1.43
diff -u -r1.43 StandardSession.java
--- catalina/src/share/org/apache/catalina/session/StandardSession.java 1 Apr
2004 20:18:15 - 1.43
+++ catalina/src/share/org/apache/catalina/session/StandardSession.java 14 Apr
2004 05:26:23 -
@@ -1398,6 +1398,8 @@
 saveNames.add(keys[i]);
 saveValues.add(value);
 } else {
+System.out.println(JRK... key being removed:  + keys[i]);
+System.out.println(JRK... instance of
HttpSessionBindingListener?  + (value instanceof HttpSessionBindingListener));
 removeAttribute(keys[i]);
 }
 }
@@ -1568,6 +1570,7 @@
 // Notify interested application event listeners
 Context context = (Context) manager.getContainer();
 Object listeners[] = context.getApplicationEventListeners();
+System.out.println(JRK... listeners are:  + listeners);
 if (listeners == null)
 return;
 for (int i = 0; i  listeners.length; i++) {


This is a valid bug, no?

Jake

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 18479] - HttpSessionBindingListener.valueUnbound() not called

2004-04-12 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=18479.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=18479

HttpSessionBindingListener.valueUnbound() not called





--- Additional Comments From [EMAIL PROTECTED]  2004-04-13 05:22 ---
You were right, Remy,

After some investigation, I figured out that one of the packages I was using
added a session attribute whose job was to react to cases where it had its
valueUnbound() method called and do some cleanup.  However, it was set as an
anonymous HttpSessionBindingListener which (obviously) doesn't implement
Serializable.  Besides that, the class in which the anonymous class was created
is not serializable and if you do a toString() on the session value that was
created, you get the name of the containing class, so I think the containing
class would have to be serializable here as well.  In any case, the alternative
method would be to just use a SessionListener#sessionDestroyed() method to do
the cleanup.  I think the former method was used because the session is already
destroyed in Jetty by the time sessionDestroyed() is called (I think that's
right?) making cleanup in sessionDestroyed() impossible (That's got to be bad
behavior on Jetty's part, but this needs to work with all containers, hence the
workaround).  Everything worked under Tomcat after I moved to using
sessionDestroyed() to do the cleanup.

However, shouldn't valueUnbound() be called on the non-serializable attribute
value when it is removed from the session HashTable?  Actually, isn't that
exactly what this bug is about?  If so, isn't this bug not really fixed?  At the
very least, some logging should be done to tell me what happening.  I wouldn't
have even have started asking questions here if Tomcat had provided me with some
hint of what it was doing instead of silently removing non-serializable attributes.


Jake

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 18479] - HttpSessionBindingListener.valueUnbound() not called

2004-04-11 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=18479.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=18479

HttpSessionBindingListener.valueUnbound() not called





--- Additional Comments From [EMAIL PROTECTED]  2004-04-11 06:12 ---
I believe the fix for this issue has caused another one.  The Tomcat-5.0.21
changlog says the following about the fix for this bug report...

18479: Non-serializable sessions attributes should be removed (so valueUnbound
is called) (markt)

I have a session that is perfectly serializable in both 5.0.19 and 5.0.20, but
as of 5.0.21, the value for the session attribute comes back null.  I also
tested in 5.0.22 with the same result.  The test consists of a hit counter that
stays in the session and should pick up right where it left off upon
server/application reload as long as the session hasn't yet timed out.

I have a HttpSessionAttributeListener reporting when objects are
added/removed/replaced in the session.  I get the report of the object in
question being added, but I never see that it has been removed or replaced.  As
such, I must assume that the session attribute is still there, but its value
changed to null somewhere behind the scenes in a way that doesn't report it to
the HttpSessionAttributeListener (at a minimum, attributeReplaced() should be
called, no?).

If this report should be separate from this bug, please say so and I'll do that,
but this one seems suspect as the cause for the issue I am seeing.  Also let me
know if more information is needed or if a test case is needed.  I, obviously,
have a test case, but it not exactly simplified.  I'll do that if what I am
reporting seems non-obvious to the Tomcat gurus.

Jake

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 18479] - HttpSessionBindingListener.valueUnbound() not called

2004-04-11 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=18479.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=18479

HttpSessionBindingListener.valueUnbound() not called





--- Additional Comments From [EMAIL PROTECTED]  2004-04-11 11:28 ---
Please don't bother.

The new code  in writeObject is:
// Accumulate the names of serializable and non-serializable attributes
String keys[] = keys();
ArrayList saveNames = new ArrayList();
ArrayList saveValues = new ArrayList();
for (int i = 0; i  keys.length; i++) {
Object value = null;
synchronized (attributes) {
value = attributes.get(keys[i]);
}
if (value == null)
continue;
else if ( (value instanceof Serializable) 
 (!exclude(keys[i]) )) {
saveNames.add(keys[i]);
saveValues.add(value);
} else {
removeAttribute(keys[i]);
}
}

The change is the added removeAttribute. The patch which broke everything is
(this is the only difference between 5.0.20 and 5.0.21):
  diff -u -r1.40 -r1.41
  --- StandardSession.java  12 Mar 2004 22:36:46 -  1.40
  +++ StandardSession.java  25 Mar 2004 22:17:54 -  1.41
  @@ -1397,6 +1397,8 @@
(!exclude(keys[i]) )) {
   saveNames.add(keys[i]);
   saveValues.add(value);
  +} else {
  +removeAttribute(keys[i]);
   }
   }

I doubt your perfectly serializable stuff actually is.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 18479] - HttpSessionBindingListener.valueUnbound() not called

2004-04-11 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=18479.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=18479

HttpSessionBindingListener.valueUnbound() not called





--- Additional Comments From [EMAIL PROTECTED]  2004-04-12 01:06 ---
Hi Remy,

I have to admit, it looks pretty rock solid, but how is it that in 5.0.20 my
session serialized/deserialized *without* error and gave me a non-null attribute
value (exactly as I expected) after reload?  Serialization is pretty straight
forward; either it is serializable and you get no errors or it isn't
serializable and you get errors.  I get no errors.  How is that not the
definition of perfectly serializable?  And if removeAttribute() is being
called, why isn't the attributeRemoved() method in my SessionBindingListener
being triggered?  I have println() statements in all methods of my
SessionBindingListener and the only ones I'm seeing are on attributeAdded(). 
You can go ahead and stick to your guns and say that my object is not
serializable (I'm 99.% sure it is), but you can't, at the same time, claim
that it is being removed from the session when attributeRemoved() is not being
triggered unless there is a bug where the removeAttribute(keys[i]) call is
not notifying listeners of the attributes it is removing.

So, I guess I'll have to investigate some more, but something is wrong here. 
Hopefully we can work together to figure it out.

Jake

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 18479] - HttpSessionBindingListener.valueUnbound() not called

2004-03-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=18479.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=18479

HttpSessionBindingListener.valueUnbound() not called

[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED



--- Additional Comments From [EMAIL PROTECTED]  2004-03-25 22:26 ---
Fixed in CVS for TC4 and TC5.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 18479] - HttpSessionBindingListener.valueUnbound() not called

2003-03-30 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18479.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18479

HttpSessionBindingListener.valueUnbound() not called





--- Additional Comments From [EMAIL PROTECTED]  2003-03-31 01:42 ---
With version 4.1.24 it does call it on a timeout. However, it does not call it 
if Tomcat is shut down and if the listener class is not serializable it is not 
brought back when Tomcat restarts.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]