[jira] [Commented] (COLLECTIONS-599) HashEntry array object naming data initialized with double the size during deserialization

2018-02-02 Thread Saleem Akbar (JIRA)

[ 
https://issues.apache.org/jira/browse/COLLECTIONS-599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16350096#comment-16350096
 ] 

Saleem Akbar commented on COLLECTIONS-599:
--

Thanks :-)



> HashEntry array object naming data initialized with double the size during 
> deserialization
> --
>
> Key: COLLECTIONS-599
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-599
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Collection, Map
>Affects Versions: 3.1
>Reporter: Tejas Patel
>Priority: Critical
> Fix For: 4.1
>
>
> Common collections 3.1 and 3.2 are used at many places and frameworks 
> including struts2. 
> Supose a LinkedMap object it is created and have size greater than zero is 
> serialized. While deserializing this object , array of HashEntry naming data 
> delacred in AbstractHashedMap always initialises with a new capacity of 
> double its double of the serialized object. 
> Please see the below API declared in AbstractHashedMap class :
> {code:java}
> protected void checkCapacity()
>   {
> if (this.size >= this.threshold)
> {
>   int newCapacity = this.data.length * 2;
>   if (newCapacity <= 1073741824) {
> ensureCapacity(newCapacity);
>   }
> }
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (COLLECTIONS-599) HashEntry array object naming data initialized with double the size during deserialization

2018-02-01 Thread Gary Gregory (JIRA)

[ 
https://issues.apache.org/jira/browse/COLLECTIONS-599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16349105#comment-16349105
 ] 

Gary Gregory commented on COLLECTIONS-599:
--

The fix has been committed to git master. I re-wrote the unit test method to 
use Java 7 idioms.

> HashEntry array object naming data initialized with double the size during 
> deserialization
> --
>
> Key: COLLECTIONS-599
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-599
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Collection, Map
>Affects Versions: 3.1
>Reporter: Tejas Patel
>Priority: Critical
> Fix For: 4.1
>
>
> Common collections 3.1 and 3.2 are used at many places and frameworks 
> including struts2. 
> Supose a LinkedMap object it is created and have size greater than zero is 
> serialized. While deserializing this object , array of HashEntry naming data 
> delacred in AbstractHashedMap always initialises with a new capacity of 
> double its double of the serialized object. 
> Please see the below API declared in AbstractHashedMap class :
> {code:java}
> protected void checkCapacity()
>   {
> if (this.size >= this.threshold)
> {
>   int newCapacity = this.data.length * 2;
>   if (newCapacity <= 1073741824) {
> ensureCapacity(newCapacity);
>   }
> }
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (COLLECTIONS-599) HashEntry array object naming data initialized with double the size during deserialization

2018-02-01 Thread Saleem Akbar (JIRA)

[ 
https://issues.apache.org/jira/browse/COLLECTIONS-599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16348998#comment-16348998
 ] 

Saleem Akbar commented on COLLECTIONS-599:
--

I also came across this problem (in my scenario I ended up with an 
out-of-memory error using non-sticky session replication) and also figured out 
the same solution, which was to to calculate the threshold before populating 
the data.

 

Anyway, I've submitted the following PR's for 3.2.x (we're currently using 
3.2.2) and master.

[https://github.com/apache/commons-collections/pull/34]

[https://github.com/apache/commons-collections/pull/35]

 

If approved, could we please have an official 3.2.x release (at this point 
3.2.3) asap?

 

Cheers

Saleem

 

 

> HashEntry array object naming data initialized with double the size during 
> deserialization
> --
>
> Key: COLLECTIONS-599
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-599
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Collection, Map
>Affects Versions: 3.1
>Reporter: Tejas Patel
>Priority: Critical
> Fix For: 4.1
>
>
> Common collections 3.1 and 3.2 are used at many places and frameworks 
> including struts2. 
> Supose a LinkedMap object it is created and have size greater than zero is 
> serialized. While deserializing this object , array of HashEntry naming data 
> delacred in AbstractHashedMap always initialises with a new capacity of 
> double its double of the serialized object. 
> Please see the below API declared in AbstractHashedMap class :
> {code:java}
> protected void checkCapacity()
>   {
> if (this.size >= this.threshold)
> {
>   int newCapacity = this.data.length * 2;
>   if (newCapacity <= 1073741824) {
> ensureCapacity(newCapacity);
>   }
> }
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (COLLECTIONS-599) HashEntry array object naming data initialized with double the size during deserialization

2017-11-06 Thread mingleizhang (JIRA)

[ 
https://issues.apache.org/jira/browse/COLLECTIONS-599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16241348#comment-16241348
 ] 

mingleizhang commented on COLLECTIONS-599:
--

I suspect that whether this issue belongs to a bug, instead, I think it should 
be a performance issue.

> HashEntry array object naming data initialized with double the size during 
> deserialization
> --
>
> Key: COLLECTIONS-599
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-599
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Collection, Map
>Affects Versions: 3.1
>Reporter: Tejas Patel
>Priority: Critical
> Fix For: 4.1
>
>
> Common collections 3.1 and 3.2 are used at many places and frameworks 
> including struts2. 
> Supose a LinkedMap object it is created and have size greater than zero is 
> serialized. While deserializing this object , array of HashEntry naming data 
> delacred in AbstractHashedMap always initialises with a new capacity of 
> double its double of the serialized object. 
> Please see the below API declared in AbstractHashedMap class :
> {code:java}
> protected void checkCapacity()
>   {
> if (this.size >= this.threshold)
> {
>   int newCapacity = this.data.length * 2;
>   if (newCapacity <= 1073741824) {
> ensureCapacity(newCapacity);
>   }
> }
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (COLLECTIONS-599) HashEntry array object naming data initialized with double the size during deserialization

2017-11-06 Thread mingleizhang (JIRA)

[ 
https://issues.apache.org/jira/browse/COLLECTIONS-599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16241347#comment-16241347
 ] 

mingleizhang commented on COLLECTIONS-599:
--

I suspect that whether this issue belongs to a bug, instead, I think it should 
be a performance issue.

> HashEntry array object naming data initialized with double the size during 
> deserialization
> --
>
> Key: COLLECTIONS-599
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-599
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Collection, Map
>Affects Versions: 3.1
>Reporter: Tejas Patel
>Priority: Critical
> Fix For: 4.1
>
>
> Common collections 3.1 and 3.2 are used at many places and frameworks 
> including struts2. 
> Supose a LinkedMap object it is created and have size greater than zero is 
> serialized. While deserializing this object , array of HashEntry naming data 
> delacred in AbstractHashedMap always initialises with a new capacity of 
> double its double of the serialized object. 
> Please see the below API declared in AbstractHashedMap class :
> {code:java}
> protected void checkCapacity()
>   {
> if (this.size >= this.threshold)
> {
>   int newCapacity = this.data.length * 2;
>   if (newCapacity <= 1073741824) {
> ensureCapacity(newCapacity);
>   }
> }
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (COLLECTIONS-599) HashEntry array object naming data initialized with double the size during deserialization

2017-11-06 Thread mingleizhang (JIRA)

[ 
https://issues.apache.org/jira/browse/COLLECTIONS-599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16241304#comment-16241304
 ] 

mingleizhang commented on COLLECTIONS-599:
--

Hi, [~garydgregory] I would think this change should be in 3.X, then 4.X master 
branches can rebase code from 3.X. As I found its affects versions is 3.1.

> HashEntry array object naming data initialized with double the size during 
> deserialization
> --
>
> Key: COLLECTIONS-599
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-599
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Collection, Map
>Affects Versions: 3.1
>Reporter: Tejas Patel
>Priority: Critical
> Fix For: 4.1
>
>
> Common collections 3.1 and 3.2 are used at many places and frameworks 
> including struts2. 
> Supose a LinkedMap object it is created and have size greater than zero is 
> serialized. While deserializing this object , array of HashEntry naming data 
> delacred in AbstractHashedMap always initialises with a new capacity of 
> double its double of the serialized object. 
> Please see the below API declared in AbstractHashedMap class :
> {code:java}
> protected void checkCapacity()
>   {
> if (this.size >= this.threshold)
> {
>   int newCapacity = this.data.length * 2;
>   if (newCapacity <= 1073741824) {
> ensureCapacity(newCapacity);
>   }
> }
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (COLLECTIONS-599) HashEntry array object naming data initialized with double the size during deserialization

2017-11-06 Thread Gary Gregory (JIRA)

[ 
https://issues.apache.org/jira/browse/COLLECTIONS-599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16240470#comment-16240470
 ] 

Gary Gregory commented on COLLECTIONS-599:
--

Hi [~mingleizhang],

Please feel free to provide a pull request on GitHub with a unit test.

https://github.com/apache/commons-collections

Are you expecting that such a change would be in the 3.x AND 4.x (master) 
branches?

Gary

> HashEntry array object naming data initialized with double the size during 
> deserialization
> --
>
> Key: COLLECTIONS-599
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-599
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Collection, Map
>Affects Versions: 3.1
>Reporter: Tejas Patel
>Priority: Critical
> Fix For: 4.1
>
>
> Common collections 3.1 and 3.2 are used at many places and frameworks 
> including struts2. 
> Supose a LinkedMap object it is created and have size greater than zero is 
> serialized. While deserializing this object , array of HashEntry naming data 
> delacred in AbstractHashedMap always initialises with a new capacity of 
> double its double of the serialized object. 
> Please see the below API declared in AbstractHashedMap class :
> {code:java}
> protected void checkCapacity()
>   {
> if (this.size >= this.threshold)
> {
>   int newCapacity = this.data.length * 2;
>   if (newCapacity <= 1073741824) {
> ensureCapacity(newCapacity);
>   }
> }
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (COLLECTIONS-599) HashEntry array object naming data initialized with double the size during deserialization

2017-11-05 Thread mingleizhang (JIRA)

[ 
https://issues.apache.org/jira/browse/COLLECTIONS-599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16239959#comment-16239959
 ] 

mingleizhang commented on COLLECTIONS-599:
--

Does anyone give me a permission that can contribute code to apache/commons ? 
Thank you very much! Minglei.

> HashEntry array object naming data initialized with double the size during 
> deserialization
> --
>
> Key: COLLECTIONS-599
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-599
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Collection, Map
>Affects Versions: 3.1
>Reporter: Tejas Patel
>Priority: Critical
> Fix For: 4.1
>
>
> Common collections 3.1 and 3.2 are used at many places and frameworks 
> including struts2. 
> Supose a LinkedMap object it is created and have size greater than zero is 
> serialized. While deserializing this object , array of HashEntry naming data 
> delacred in AbstractHashedMap always initialises with a new capacity of 
> double its double of the serialized object. 
> Please see the below API declared in AbstractHashedMap class :
> protected void checkCapacity()
>   {
> if (this.size >= this.threshold)
> {
>   int newCapacity = this.data.length * 2;
>   if (newCapacity <= 1073741824) {
> ensureCapacity(newCapacity);
>   }
> }
>   }



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (COLLECTIONS-599) HashEntry array object naming data initialized with double the size during deserialization

2016-12-02 Thread Tejas Patel (JIRA)

[ 
https://issues.apache.org/jira/browse/COLLECTIONS-599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15714952#comment-15714952
 ] 

Tejas Patel commented on COLLECTIONS-599:
-

Possible fix would be calculating threshold before putting the data in 
doReadObject API. 
Calculating threshold would not initialize the array by double.
Please find the code below : 

protected void doReadObject(ObjectInputStream in)
throws IOException, ClassNotFoundException
  {
this.loadFactor = in.readFloat();
int capacity = in.readInt();
int size = in.readInt();
init();
this.data = new HashEntry[capacity];
this.threshold = calculateThreshold(this.data.length, this.loadFactor);
for (int i = 0; i < size; i++)
{
  Object key = in.readObject();
  Object value = in.readObject();
  put(key, value);
}

  }

Why these is critical because this version of jar are been used by struts 2 . 
I saw these been changed in version 4.1 , but if you classes in 4.1 are 
declared in different package.
We should have provide fix for these version as we cant change jars which is 
internally using these stuff. 



> HashEntry array object naming data initialized with double the size during 
> deserialization
> --
>
> Key: COLLECTIONS-599
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-599
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Collection, Map
>Affects Versions: 3.1
>Reporter: Tejas Patel
>Priority: Critical
> Fix For: 4.1
>
>
> Common collections 3.1 and 3.2 are used at many places and frameworks 
> including struts2. 
> Supose a LinkedMap object it is created and have size greater than zero is 
> serialized. While deserializing this object , array of HashEntry naming data 
> delacred in AbstractHashedMap always initialises with a new capacity of 
> double its double of the serialized object. 
> Please see the below API declared in AbstractHashedMap class :
> protected void checkCapacity()
>   {
> if (this.size >= this.threshold)
> {
>   int newCapacity = this.data.length * 2;
>   if (newCapacity <= 1073741824) {
> ensureCapacity(newCapacity);
>   }
> }
>   }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)