lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <>
Subject [jira] [Commented] (SOLR-12021) Utils.fromJSONResource(...) and ValidatingJsonMap.parse(...) open (resourse) InputStreams they don't close
Date Fri, 23 Feb 2018 18:53:00 GMT


ASF subversion and git services commented on SOLR-12021:

Commit 378c743bd286478236bd5ba18d2fc3535afc3b08 in lucene-solr's branch refs/heads/branch_7x
from Chris Hostetter
[;h=378c743 ]

SOLR-12021: Fixed a bug in ApiSpec and other JSON resource loading that was causing unclosed
file handles

(cherry picked from commit 9e0e301f9fe4a1b5e33925ae4d2848ead71cca25)

> Utils.fromJSONResource(...) and ValidatingJsonMap.parse(...) open (resourse) InputStreams
they don't close
> ----------------------------------------------------------------------------------------------------------
>                 Key: SOLR-12021
>                 URL:
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Hoss Man
>            Assignee: Hoss Man
>            Priority: Major
>         Attachments: SOLR-12021.patch
> A recurring theme that pops up now and then in non-reproducible test failures is for
an error like this to show up in the log files when a core/collection is being created...
> {noformat}
>    [junit4]   2> 674805 ERROR (qtp1337497394-5597) [n: c:collection2
s:shard6  x:collection2_shard6_replica_n29] o.a.s.h.RequestHandlerBase org.apache.solr.common.SolrException:
Error CREATEing SolrCore 'collection2_shard6_replica_n29': Unable to create core [collection2_shard6_replica_n29]
Caused by: invalid API spec: apispec/core.config.Commands.json
> ...
>    [junit4]   2> Caused by: java.lang.RuntimeException: invalid API spec: apispec/core.config.Commands.json
>    [junit4]   2>        at org.apache.solr.common.util.ValidatingJsonMap.parse(
>    [junit4]   2>        at org.apache.solr.common.util.Utils.lambda$getSpec$0(
>    [junit4]   2>        at org.apache.solr.api.Api.getSpec(
>    [junit4]   2>        at org.apache.solr.api.ApiBag.register(
>    [junit4]   2>        at org.apache.solr.core.PluginBag.put(
>    [junit4]   2>        at org.apache.solr.core.PluginBag.init(
>    [junit4]   2>        at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(
>    [junit4]   2>        at org.apache.solr.core.SolrCore.<init>(
> {noformat}
> I _believe_ that the root cause of these types of failures is that these API spec files
are being loaded with {{ValidatingJsonMap.class.getClassLoader().getResourceAsStream(resourceName)}}
-- but nothing is ever closing the stream, so it can eventually (depending on what test classes
run in each JVM and how many files they try to open like this) cause the JVM to hit the ulimit
for open file handles -- but that specific cause of the failure is never reported, because
{{ClassLoader.getResourseAsStream(...)}} is explicity designed to swallow any IOExceptions
encountered and just returns "null" (which triggers the "invalid API spec: " thrown by ValidatingJsonMap)
> ----
> {{ValidatingJsonMap.parse(...)}} and the very similarly looking {{Utils.fromJSONResource(...)}}
should be modified to:
> * ensure they always close the streams they open
> * use {{ClassLoader.getResource()}} + {{URL.openConnection()}} so that they can properly
log if/when an underlying IOException occurs w/details

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message