History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: PSL-287
Type: Bug Bug
Status: Closed Closed
Resolution: Duplicate
Priority: Major Major
Assignee: Jens Halm
Reporter: Alvaro Vasconcelos
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Parsley - Spicelib

Reloading modules problem

Created: 18/Nov/09 01:02 PM   Updated: 09/Jun/10 09:13 AM
Component/s: None
Affects Version/s: 2.1.0
Fix Version/s: 2.1.1

File Attachments: 1. Zip Archive ReloadingModulesSample.zip (211 kb)

Issue Links:
Duplicate
 


 Description  « Hide
Sample app that isolates the problem (discussed on http://www.spicefactory.org/forum/viewtopic.php?t=372).
Sorry about some ugly code, but I tried to simplify and isolate as much as possible the problem.

Guidelines:
Module 1 is loaded at the beginning.
Step to reproduce:
1º Click Forward button (Module 2 is loaded)
2º Click Back button (Module 1 is reloaded), then we get the error.


 All   Comments   Change History      Sort Order:
Jens Halm - 18/Nov/09 02:24 PM
Hm, seems that you did not attach anything?

Alvaro Vasconcelos - 18/Nov/09 03:01 PM
I tried several times with Opera. But failed everytime.
Now with IE it's done.

Alvaro Vasconcelos - 18/Nov/09 03:22 PM
I was browsing another issues and seems to me that this one is related with http://opensource.powerflasher.com/jira/browse/PSL-286

Jens Halm - 18/Nov/09 03:46 PM
Yes, the sample app in that ticket is from the other poster in the same forum thread. I'll definitely examine both and close one of the tickets as duplicate if the issues have the same cause.

Jens Halm - 18/Nov/09 03:47 PM
Oh, and thanks for providing the sample. Hopefully I'll be able to resolve this over the weekend.

Jens Halm - 23/Nov/09 12:43 AM - edited
After some initial investigation it looks like this will be a difficult issue. I narrowed the problem down a bit, but still no idea why this is happening.

You define a String object in your module configuration, so Parsley must reflect on the String class. When the module Context is created for the first time, the describeType output for String looks good:

<type name="String" base="Class" isDynamic="true" isFinal="true" isStatic="true">
  <extendsClass type="Class"/>
  <extendsClass type="Object"/>
  <constant name="length" type="int"/>
  <accessor name="prototype" access="readonly" type="*" declaredBy="Class"/>
  <factory type="String">
    <extendsClass type="Object"/>
    <constructor>
      <parameter index="1" type="*" optional="true"/>
    </constructor>
    <accessor name="length" access="readonly" type="int" declaredBy="String"/>
  </factory>
</type>

When loading it the second time the output looks like this:

<type name="null" isDynamic="false" isFinal="true" isStatic="false"/>

The Spicelib Reflection API which Parsley relies on chokes on this strange output, obviously.

So the next task is to find out how/why this is happening.

Jens Halm - 23/Nov/09 01:44 AM
One question which might help digging deeper: Do you unload the first module anywhere? Or do you just reload it without unloading? I did a search and did not find a call to moduleInfo.unload().

Alvaro Vasconcelos - 23/Nov/09 12:15 PM
I just reload it without unloading. And that is the problem...after reading your comment I started to unload the modules before reloading a new one. Just to be sure. And everything started to work. Is it advisable to unload it every time?

Jens Halm - 23/Nov/09 12:24 PM
No, usually you are not required to unload before reloading, only as a workaround until bug #290 is fixed, which deals with exactly that issue: The internal logic in Parsley's module support is broken, if the same module gets loaded twice without unloading inbetween.

Apart from that, even if the bug is fixed you may consider unloading under certain circumstances, depending on the size and number of modules and their memory consumption.

Jens Halm - 23/Nov/09 01:39 PM
Duplicate of PSL-290.