You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2019/08/30 13:34:00 UTC

[jira] [Commented] (GEODE-7106) NumberFormatException for input string "MAX_PARTITIONED_REGION_ID"

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

ASF subversion and git services commented on GEODE-7106:
--------------------------------------------------------

Commit 81a116328f1383e54d9a310063021cb12668ee8d in geode's branch refs/heads/develop from Juan José Ramos
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=81a1163 ]

GEODE-7106: Prevent NFE During PRid Generation (#3958)

- Added tests.
- Fixed minor warnings.
- While releasing the distributed lock acquired to generate a new
  global partitioned region ID, don't parse the String
  MAX_PARTITIONED_REGION_ID as an Integer.

> NumberFormatException for input string "MAX_PARTITIONED_REGION_ID"
> ------------------------------------------------------------------
>
>                 Key: GEODE-7106
>                 URL: https://issues.apache.org/jira/browse/GEODE-7106
>             Project: Geode
>          Issue Type: Bug
>          Components: regions
>            Reporter: Juan José Ramos Cassella
>            Assignee: Juan José Ramos Cassella
>            Priority: Major
>              Labels: GeodeCommons
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> Whenever an {{Exception}} is thrown while trying to release the distributed lock used to register a partitioned region, we log a warning message with the original exception, the problem is that we wrongly execute {{Integer.valueOf(PartitionedRegionHelper.MAX_PARTITIONED_REGION_ID)}} and {{PartitionedRegionHelper.MAX_PARTITIONED_REGION_ID}} is of type {{String}}, resulting in the {{NumberFormatException}}
> {code:title=PartitionedRegion.java|borderStyle=solid}
> private static void releasePRIDLock(final DistributedLockService lockService) {
>     try {
>       lockService.unlock(PartitionedRegionHelper.MAX_PARTITIONED_REGION_ID);
>       if (logger.isDebugEnabled()) {
>         logger.debug("releasePRIDLock: Released the dlock in allPartitionedRegions for {}",
>             PartitionedRegionHelper.MAX_PARTITIONED_REGION_ID);
>       }
>     } catch (Exception es) {
>       logger.warn(String.format("releasePRIDLock: unlocking %s caught an exception",
>           Integer.valueOf(PartitionedRegionHelper.MAX_PARTITIONED_REGION_ID)),
>           es);
>     }
>   }
> {code}
> {code:title=PartitionedRegionHelper.java|borderStyle=solid}
> static final String MAX_PARTITIONED_REGION_ID = "MAX_PARTITIONED_REGION_ID";
> {code}
> The actual stack trace:
> {noformat}
> [warn 2019/08/20 22:06:27.520 PDT <vm_2_thr_6_accessor3_host1_4065> tid=0x1a] Initialization failed for Region /PR_4
> org.apache.geode.internal.cache.PartitionedRegionException: An exception was caught while registering PartitionedRegion /PR_4. dumpPRId: prIdToPR Map@134033921:
> , caused by java.lang.NumberFormatException: For input string: "MAX_PARTITIONED_REGION_ID"
> 	at org.apache.geode.internal.cache.PartitionedRegion.registerPartitionedRegion(PartitionedRegion.java:1472)
> 	at org.apache.geode.internal.cache.PartitionedRegion.initPRInternals(PartitionedRegion.java:1009)
> 	at org.apache.geode.internal.cache.PartitionedRegion.initialize(PartitionedRegion.java:1177)
> 	at org.apache.geode.internal.cache.GemFireCacheImpl.createVMRegion(GemFireCacheImpl.java:3053)
> 	at org.apache.geode.internal.cache.GemFireCacheImpl.basicCreateRegion(GemFireCacheImpl.java:2941)
> 	at org.apache.geode.internal.cache.GemFireCacheImpl.createRegion(GemFireCacheImpl.java:2928)
> 	at hydra.RegionHelper.createRegion(RegionHelper.java:106)
> 	at hydra.RegionHelper.createRegion(RegionHelper.java:76)
> 	at hydra.RegionHelper.createRegion(RegionHelper.java:65)
> 	at diskRecovery.StartupShutdownTest.createRegions(StartupShutdownTest.java:156)
> 	at diskRecovery.StartupShutdownTest.HydraTask_initializeProxy(StartupShutdownTest.java:295)
> 	at diskRecovery.StartupShutdownTest.HydraTask_initializeProxyDuringShutDownAll(StartupShutdownTest.java:318)
> 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> 	at hydra.MethExecutor.execute(MethExecutor.java:173)
> 	at hydra.MethExecutor.execute(MethExecutor.java:141)
> 	at hydra.TestTask.execute(TestTask.java:197)
> 	at hydra.RemoteTestModule$1.run(RemoteTestModule.java:213)
> Caused by: java.lang.NumberFormatException: For input string: "MAX_PARTITIONED_REGION_ID"
> 	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
> 	at java.base/java.lang.Integer.parseInt(Integer.java:652)
> 	at java.base/java.lang.Integer.valueOf(Integer.java:983)
> 	at org.apache.geode.internal.cache.PartitionedRegion.releasePRIDLock(PartitionedRegion.java:4960)
> 	at org.apache.geode.internal.cache.PartitionedRegion._generatePRId(PartitionedRegion.java:5010)
> 	at org.apache.geode.internal.cache.PartitionedRegion.generatePRId(PartitionedRegion.java:4970)
> 	at org.apache.geode.internal.cache.PartitionedRegion.registerPartitionedRegion(PartitionedRegion.java:1383)
> 	... 19 more
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.2#803003)