Mantis - Quercus
Viewing Issue Advanced Details
5324 crash always 12-27-12 13:05 07-17-23 19:26
publicocean0  
 
normal  
new 4.0.34  
open  
none    
none  
0005324: Overflow i copy a php object
If i create a object in which there is inside a reference to the same object
the internal copy assignment crashs.

The copy assignment function works in bad way ... it create a copy of the same object infinitelly ... maybe it dont manage the pointer reference in php ?
It seams to appear when i use php serialization .... used with function __wakeup

java.lang.StackOverflowError
    java.util.IdentityHashMap.hash(IdentityHashMap.java:284)
    java.util.IdentityHashMap.get(IdentityHashMap.java:317)
    com.caucho.quercus.env.ObjectExtValue.copy(ObjectExtValue.java:1017)
    com.caucho.quercus.env.ObjectExtValue$Entry.<init>(ObjectExtValue.java:1742)
    com.caucho.quercus.env.ObjectExtValue.<init>(ObjectExtValue.java:133)
    com.caucho.quercus.env.ObjectExtValue.copy(ObjectExtValue.java:1024)
    com.caucho.quercus.env.ObjectExtValue$Entry.<init>(ObjectExtValue.java:1742)
    com.caucho.quercus.env.ObjectExtValue.<init>(ObjectExtValue.java:133)
    com.caucho.quercus.env.ObjectExtValue.copy(ObjectExtValue.java:1024)
    com.caucho.quercus.env.ObjectExtValue$Entry.<init>(ObjectExtValue.java:1742)
    com.caucho.quercus.env.ObjectExtValue.<init>(ObjectExtValue.java:133)
    com.caucho.quercus.env.ObjectExtValue.copy(ObjectExtValue.java:1024)
    com.caucho.quercus.env.ObjectExtValue$Entry.<init>(ObjectExtValue.java:1742)
    com.caucho.quercus.env.ObjectExtValue.<init>(ObjectExtValue.java:133)
    com.caucho.quercus.env.ObjectExtValue.copy(ObjectExtValue.java:1024)
    com.caucho.quercus.env.ObjectExtValue$Entry.<init>(ObjectExtValue.java:1742)
    com.caucho.quercus.env.ObjectExtValue.<init>(ObjectExtValue.java:133)
    com.caucho.quercus.env.ObjectExtValue.copy(ObjectExtValue.java:1024)
    com.caucho.quercus.env.ObjectExtValue$Entry.<init>(ObjectExtValue.java:1742)
    com.caucho.quercus.env.ObjectExtValue.<init>(ObjectExtValue.java:133)
    com.caucho.quercus.env.ObjectExtValue.copy(ObjectExtValue.java:1024)
    com.caucho.quercus.env.ObjectExtValue$Entry.<init>(ObjectExtValue.java:1742)
    com.caucho.quercus.env.ObjectExtValue.<init>(ObjectExtValue.java:133)
    com.caucho.quercus.env.ObjectExtValue.copy(ObjectExtValue.java:1024)
    com.caucho.quercus.env.ObjectExtValue$Entry.<init>(ObjectExtValue.java:1742)
    com.caucho.quercus.env.ObjectExtValue.<init>(ObjectExtValue.java:133)
    com.caucho.quercus.env.ObjectExtValue.copy(ObjectExtValue.java:1024)
    com.caucho.quercus.env.ObjectExtValue$Entry.<init>(ObjectExtValue.java:1742)
    com.caucho.quercus.env.ObjectExtValue.<init>(ObjectExtValue.java:133)
    com.caucho.quercus.env.ObjectExtValue.copy(ObjectExtValue.java:1024)
    com.caucho.quercus.env.ObjectExtValue$Entry.<init>(ObjectExtValue.java:1742)
    com.caucho.quercus.env.ObjectExtValue.<init>(ObjectExtValue.java:133)
    com.caucho.quercus.env.ObjectExtValue.copy(ObjectExtValue.java:1024)
    com.caucho.quercus.env.ObjectExtValue$Entry.<init>(ObjectExtValue.java:1742)
    com.caucho.quercus.env.ObjectExtValue.<init>(ObjectExtValue.java:133)
    com.caucho.quercus.env.ObjectExtValue.copy(ObjectExtValue.java:1024)
    com.caucho.quercus.env.ObjectExtValue$Entry.<init>(ObjectExtValue.java:1742)
    com.caucho.quercus.env.ObjectExtValue.<init>(ObjectExtValue.java:133)
    com.caucho.quercus.env.ObjectExtValue.copy(ObjectExtValue.java:1024)
    com.caucho.quercus.env.ObjectExtValue$Entry.<init>(ObjectExtValue.java:1742)
    com.caucho.quercus.env.ObjectExtValue.<init>(ObjectExtValue.java:133)
    com.caucho.quercus.env.ObjectExtValue.copy(ObjectExtValue.java:1024)
    com.caucho.quercus.env.ObjectExtValue$Entry.<init>(ObjectExtValue.java:1742)
    com.caucho.quercus.env.ObjectExtValue.<init>(ObjectExtValue.java:133)
    com.caucho.quercus.env.ObjectExtValue.copy(ObjectExtValue.java:1024)
    com.caucho.quercus.env.ObjectExtValue$Entry.<init>(ObjectExtValue.java:1742)
    com.caucho.quercus.env.ObjectExtValue.<init>(ObjectExtValue.java:133)
    com.caucho.quercus.env.ObjectExtValue.copy(ObjectExtValue.java:1024)
    com.caucho.quercus.env.ObjectExtValue$Entry.<init>(ObjectExtValue.java:174

Notes
(0006126)
nam   
12-27-12 16:09   
Hi, are you sure you're using 4.0.34? Because the stack traces don't look like 4.0.34. And can you provide a PHP sample? I'm unable to reproduce it with:

class A
{
  var $foo;
}

$a = new A();
$a->foo = array($a);

$b = serialize($a);
var_dump($b);

$c = unserialize($b);
var_dump($c);
(0006132)
publicocean0   
12-30-12 03:22   
Yes Quercus version is 4.034.
I can't send my php code because for now is a prototype, but your example dont hit the problem.
The problem is in the way in which you make the copy of a variable in quercus.
In general you can build a hierarchical structure in which you use many times a reference to a node. In php it works because it make a difference if you pass a node as pointer or var copy, in your quercus version you dont make this difference but you consider it always as a var copy: the consequence is that error.
For replicating that error you might build a structure that contains recursive information passed as reference.
the solution for my opinion is introduce, as in php, the concept of var reference in your quercus code ... if the copy find a kinda var dont call ,in the recursive way, the copy method. :)
(0006135)
nam   
12-01-12 16:10   
Hi, I still suspect that you're using an older version. Can you download http://www.caucho.com/download/resin-pro-4.0.33.tar.gz [^] and give it a try? If you're not using Resin, you should just be able to copy resin/lib/resin.jar into your server's WEB-INF/lib directory.
(0006136)
publicocean0   
01-01-13 03:15   
I quercus version i used is 4.034. I tried too you last jar. I saw also the code and i suggested the solution too.
I think that is a important bug because it could implicate the entire your project. I advice to analyzed in deep the problem.
(0006137)
nam   
01-02-13 10:07   
4.0.34 is not out yet. 4.0.33 is the latest version.