[jira] [Commented] (AVRO-1923) Recursive record causes StackOverflow in GenericData.toString

2016-11-05 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/AVRO-1923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15640510#comment-15640510
 ] 

ASF subversion and git services commented on AVRO-1923:
---

Commit aa0ee44822a62fd087fa8cca169dfef4e182af0f in avro's branch 
refs/heads/branch-1.8 from [~nielsbasjes]
[ https://git-wip-us.apache.org/repos/asf?p=avro.git;h=aa0ee44 ]

AVRO-1923: Stop infinite recursion in GenericData.toString


> Recursive record causes StackOverflow in GenericData.toString
> -
>
> Key: AVRO-1923
> URL: https://issues.apache.org/jira/browse/AVRO-1923
> Project: Avro
>  Issue Type: Bug
>Reporter: Niels Basjes
>Assignee: Niels Basjes
> Attachments: AVRO-1923-Unittest.patch
>
>




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


[jira] [Commented] (AVRO-1923) Recursive record causes StackOverflow in GenericData.toString

2016-10-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/AVRO-1923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15545527#comment-15545527
 ] 

ASF GitHub Bot commented on AVRO-1923:
--

Github user nielsbasjes closed the pull request at:

https://github.com/apache/avro/pull/128


> Recursive record causes StackOverflow in GenericData.toString
> -
>
> Key: AVRO-1923
> URL: https://issues.apache.org/jira/browse/AVRO-1923
> Project: Avro
>  Issue Type: Bug
>Reporter: Niels Basjes
>Assignee: Niels Basjes
> Attachments: AVRO-1923-Unittest.patch
>
>




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


[jira] [Commented] (AVRO-1923) Recursive record causes StackOverflow in GenericData.toString

2016-10-04 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/AVRO-1923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15545480#comment-15545480
 ] 

ASF subversion and git services commented on AVRO-1923:
---

Commit e276aa5e40cf51e36b581750c135c9c3875cac84 in avro's branch 
refs/heads/master from [~nielsbasjes]
[ https://git-wip-us.apache.org/repos/asf?p=avro.git;h=e276aa5 ]

AVRO-1923: Stop infinite recursion in GenericData.toString


> Recursive record causes StackOverflow in GenericData.toString
> -
>
> Key: AVRO-1923
> URL: https://issues.apache.org/jira/browse/AVRO-1923
> Project: Avro
>  Issue Type: Bug
>Reporter: Niels Basjes
>Assignee: Niels Basjes
> Attachments: AVRO-1923-Unittest.patch
>
>




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


[jira] [Commented] (AVRO-1923) Recursive record causes StackOverflow in GenericData.toString

2016-10-04 Thread Niels Basjes (JIRA)

[ 
https://issues.apache.org/jira/browse/AVRO-1923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15545481#comment-15545481
 ] 

Niels Basjes commented on AVRO-1923:


Committed.

> Recursive record causes StackOverflow in GenericData.toString
> -
>
> Key: AVRO-1923
> URL: https://issues.apache.org/jira/browse/AVRO-1923
> Project: Avro
>  Issue Type: Bug
>Reporter: Niels Basjes
>Assignee: Niels Basjes
> Attachments: AVRO-1923-Unittest.patch
>
>




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


[jira] [Commented] (AVRO-1923) Recursive record causes StackOverflow in GenericData.toString

2016-09-29 Thread Doug Cutting (JIRA)

[ 
https://issues.apache.org/jira/browse/AVRO-1923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15533880#comment-15533880
 ] 

Doug Cutting commented on AVRO-1923:


The remove doesn't need to be in a 'finally' block.  I mistakenly pseudo-coded 
it that way to simplify return logic, but this wasn't needed as the toString 
logic doesn't use return.

The reason for removing each time is to bound the size of the map to the depth 
of the stack.  Otherwise it grows to the size of the structure.  It'll work 
fine without the removes too, I just preferred to minimize memory use.

Your patch looks fine.  +1

> Recursive record causes StackOverflow in GenericData.toString
> -
>
> Key: AVRO-1923
> URL: https://issues.apache.org/jira/browse/AVRO-1923
> Project: Avro
>  Issue Type: Bug
>Reporter: Niels Basjes
>Assignee: Niels Basjes
> Attachments: AVRO-1923-Unittest.patch
>
>




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


[jira] [Commented] (AVRO-1923) Recursive record causes StackOverflow in GenericData.toString

2016-09-28 Thread Niels Basjes (JIRA)

[ 
https://issues.apache.org/jira/browse/AVRO-1923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15529733#comment-15529733
 ] 

Niels Basjes commented on AVRO-1923:


Yes, that is better (see updated pull request). 

One thing I left out is removing it in a finally block.
It is an operation that I think is not needed (at the end of the toString the 
entire Map is discarded anyway).
Why do you do it?
Is it needed?


> Recursive record causes StackOverflow in GenericData.toString
> -
>
> Key: AVRO-1923
> URL: https://issues.apache.org/jira/browse/AVRO-1923
> Project: Avro
>  Issue Type: Bug
>Reporter: Niels Basjes
>Assignee: Niels Basjes
> Attachments: AVRO-1923-Unittest.patch
>
>




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


[jira] [Commented] (AVRO-1923) Recursive record causes StackOverflow in GenericData.toString

2016-09-26 Thread Doug Cutting (JIRA)

[ 
https://issues.apache.org/jira/browse/AVRO-1923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15523879#comment-15523879
 ] 

Doug Cutting commented on AVRO-1923:


Elsewhere in Avro we handle circular structures by keeping track of previously 
seen objects, with no limit on the depth of circularity.  So this might instead 
look something like:
{code}
public String toString(Object o, StringBuffer b) {
  return toStringInternal(o, b, new IdentityHashMap());
}
public String toString(Object o, StringBuffer b, Map seen) {
  if (seen.containsKey(o))
return ... ; // circle detected 
  try {
seen.put(o, o);
... prior toString logic ...
  } finally {
seen.remove(o);
  }
}
{code}

> Recursive record causes StackOverflow in GenericData.toString
> -
>
> Key: AVRO-1923
> URL: https://issues.apache.org/jira/browse/AVRO-1923
> Project: Avro
>  Issue Type: Bug
>Reporter: Niels Basjes
>Assignee: Niels Basjes
> Attachments: AVRO-1923-Unittest.patch
>
>




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


[jira] [Commented] (AVRO-1923) Recursive record causes StackOverflow in GenericData.toString

2016-09-22 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/AVRO-1923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15513224#comment-15513224
 ] 

ASF GitHub Bot commented on AVRO-1923:
--

GitHub user nielsbasjes opened a pull request:

https://github.com/apache/avro/pull/128

AVRO-1923: Stop infinite recursion in GenericData.toString

Simply keep count of the recursion depth and stop at 50 (which seems to me 
like a good value)

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/nielsbasjes/avro AVRO-1923

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/avro/pull/128.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #128


commit 1a0c0ee22e891537e58f713d3e5dee11b3396da7
Author: Niels Basjes 
Date:   2016-09-22T12:42:47Z

AVRO-1923: Stop infinite recursion in GenericData.toString




> Recursive record causes StackOverflow in GenericData.toString
> -
>
> Key: AVRO-1923
> URL: https://issues.apache.org/jira/browse/AVRO-1923
> Project: Avro
>  Issue Type: Bug
>Reporter: Niels Basjes
>Assignee: Niels Basjes
> Attachments: AVRO-1923-Unittest.patch
>
>




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