You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Ryabov Dmitrii (JIRA)" <ji...@apache.org> on 2017/09/12 13:18:00 UTC

[jira] [Commented] (IGNITE-602) [Test] GridToStringBuilder is vulnerable for StackOverflowError caused by infinite recursion

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

Ryabov Dmitrii commented on IGNITE-602:
---------------------------------------

[~agura], do we really need it? Object's hashcode can be changed between two toString() calls. I suppose different hashcodes for the same object will be look very bad in logs.

It is easy to insert hashcode in the middle of the buffer, but to do it I need to replace IdentityHashMap with List of key-value objects which contain Object as key and it's position as value (to insert hashcode if needed). But this way will create more objects and additional redundant pressure to GC, which we are trying to avoid. Or write something like IdentityLinkedHashMap by myself, cause there is no IdentityLinkedHashMap in JDK.

> [Test] GridToStringBuilder is vulnerable for StackOverflowError caused by infinite recursion
> --------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-602
>                 URL: https://issues.apache.org/jira/browse/IGNITE-602
>             Project: Ignite
>          Issue Type: Bug
>          Components: general
>            Reporter: Artem Shutak
>            Assignee: Ryabov Dmitrii
>              Labels: MakeTeamcityGreenAgain, Muted_test
>             Fix For: 2.3
>
>
> See test org.gridgain.grid.util.tostring.GridToStringBuilderSelfTest#_testToStringCheckAdvancedRecursionPrevention and related TODO in same source file.
> Also take a look at http://stackoverflow.com/questions/11300203/most-efficient-way-to-prevent-an-infinite-recursion-in-tostring
> Test should be unmuted on TC after fix.



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