muse-dev[bot] commented on a change in pull request #1963:
URL: https://github.com/apache/lucene-solr/pull/1963#discussion_r501702700



##########
File path: solr/core/src/java/org/apache/solr/schema/IndexSchema.java
##########
@@ -474,23 +481,28 @@ protected Analyzer getWrappedAnalyzer(String fieldName) {
     }
   }
 
-  protected void readSchema(InputSource is) {
+  protected void readSchema(ConfigSetService.ConfigResource is) {
     assert null != is : "schema InputSource should never be null";
     try {
-      // pass the config resource loader to avoid building an empty one for no 
reason:
-      // in the current case though, the stream is valid so we wont load the 
resource by name
-      XmlConfigFile schemaConf = new XmlConfigFile(loader, SCHEMA, is, 
SLASH+SCHEMA+SLASH, substitutableProperties);
-      Document document = schemaConf.getDocument();
-      final XPath xpath = schemaConf.getXPath();
-      String expression = stepsToPath(SCHEMA, AT + NAME);
-      Node nd = (Node) xpath.evaluate(expression, document, 
XPathConstants.NODE);
+      rootNode = is.getParsed();
+      if(rootNode == null) {
+        // pass the config resource loader to avoid building an empty one for 
no reason:
+        // in the current case though, the stream is valid so we wont load the 
resource by name
+        XmlConfigFile schemaConf = new XmlConfigFile(loader, SCHEMA, 
is.getSource(), SLASH+SCHEMA+SLASH, null);
+//      Document document = schemaConf.getDocument();
+//      final XPath xpath = schemaConf.getXPath();
+//      String expression = stepsToPath(SCHEMA, AT + NAME);
+//      Node nd = (Node) xpath.evaluate(expression, document, 
XPathConstants.NODE);
+        rootNode = new DataConfigNode(new 
DOMConfigNode(schemaConf.getDocument().getDocumentElement())) ;

Review comment:
       *NULL_DEREFERENCE:*  object returned by `getDocument(schemaConf)` could 
be null and is dereferenced at line 496.

##########
File path: solr/core/src/java/org/apache/solr/schema/IndexSchema.java
##########
@@ -608,7 +629,7 @@ protected void readSchema(InputSource is) {
       // expression = "/schema/copyField";
 
       dynamicCopyFields = new DynamicCopy[] {};

Review comment:
       *THREAD_SAFETY_VIOLATION:*  Unprotected write. Non-private method 
`IndexSchema.readSchema(...)` writes to field `this.dynamicCopyFields` outside 
of synchronization.
    Reporting because another access to the same memory occurs on a background 
thread, although this access may not.

##########
File path: 
solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
##########
@@ -174,8 +175,8 @@ public ManagedIndexSchema create(String resourceName, 
SolrConfig config) {
     }
     InputSource inputSource = new InputSource(schemaInputStream);
     
inputSource.setSystemId(SystemIdResolver.createSystemIdFromResourceName(loadedResource));

Review comment:
       *THREAD_SAFETY_VIOLATION:*  Read/Write race. Non-private method 
`ManagedIndexSchemaFactory.create(...)` reads without synchronization from 
`this.loadedResource`. Potentially races with write in method 
`ManagedIndexSchemaFactory.create(...)`.
    Reporting because this access may occur on a background thread.

##########
File path: 
solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
##########
@@ -174,8 +175,8 @@ public ManagedIndexSchema create(String resourceName, 
SolrConfig config) {
     }
     InputSource inputSource = new InputSource(schemaInputStream);
     
inputSource.setSystemId(SystemIdResolver.createSystemIdFromResourceName(loadedResource));
-    schema = new ManagedIndexSchema(config, loadedResource, inputSource, 
isMutable,
-                                    managedSchemaResourceName, 
schemaZkVersion, getSchemaUpdateLock());
+    schema = new ManagedIndexSchema(config, loadedResource, () -> inputSource, 
isMutable,
+        managedSchemaResourceName, schemaZkVersion, getSchemaUpdateLock());
     if (shouldUpgrade) {

Review comment:
       *THREAD_SAFETY_VIOLATION:*  Read/Write race. Non-private method 
`ManagedIndexSchemaFactory.create(...)` reads without synchronization from 
`this.shouldUpgrade`. Potentially races with write in method 
`ManagedIndexSchemaFactory.create(...)`.
    Reporting because this access may occur on a background thread.

##########
File path: 
solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
##########
@@ -174,8 +175,8 @@ public ManagedIndexSchema create(String resourceName, 
SolrConfig config) {
     }
     InputSource inputSource = new InputSource(schemaInputStream);
     
inputSource.setSystemId(SystemIdResolver.createSystemIdFromResourceName(loadedResource));
-    schema = new ManagedIndexSchema(config, loadedResource, inputSource, 
isMutable,
-                                    managedSchemaResourceName, 
schemaZkVersion, getSchemaUpdateLock());
+    schema = new ManagedIndexSchema(config, loadedResource, () -> inputSource, 
isMutable,
+        managedSchemaResourceName, schemaZkVersion, getSchemaUpdateLock());

Review comment:
       *THREAD_SAFETY_VIOLATION:*  Unprotected write. Non-private method 
`ManagedIndexSchemaFactory.create(...)` indirectly writes to field 
`config.overlay` outside of synchronization.
    Reporting because this access may occur on a background thread.

##########
File path: 
solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
##########
@@ -109,7 +110,7 @@ public String getSchemaResourceName(String cdResourceName) {
    * renamed by appending the extension named in {@link 
#UPGRADED_SCHEMA_EXTENSION}.
    */
   @Override
-  public ManagedIndexSchema create(String resourceName, SolrConfig config) {
+  public ManagedIndexSchema create(String resourceName, SolrConfig config, 
ConfigSetService configSetService) {
     this.resourceName = resourceName;
     this.config = config;

Review comment:
       *THREAD_SAFETY_VIOLATION:*  Unprotected write. Non-private method 
`ManagedIndexSchemaFactory.create(...)` writes to field `this.config` outside 
of synchronization.
    Reporting because this access may occur on a background thread.

##########
File path: 
solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
##########
@@ -109,7 +110,7 @@ public String getSchemaResourceName(String cdResourceName) {
    * renamed by appending the extension named in {@link 
#UPGRADED_SCHEMA_EXTENSION}.
    */
   @Override
-  public ManagedIndexSchema create(String resourceName, SolrConfig config) {
+  public ManagedIndexSchema create(String resourceName, SolrConfig config, 
ConfigSetService configSetService) {
     this.resourceName = resourceName;
     this.config = config;
     this.loader = config.getResourceLoader();

Review comment:
       *THREAD_SAFETY_VIOLATION:*  Unprotected write. Non-private method 
`ManagedIndexSchemaFactory.create(...)` writes to field `this.loader` outside 
of synchronization.
    Reporting because this access may occur on a background thread.

##########
File path: 
solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
##########
@@ -109,7 +110,7 @@ public String getSchemaResourceName(String cdResourceName) {
    * renamed by appending the extension named in {@link 
#UPGRADED_SCHEMA_EXTENSION}.
    */
   @Override
-  public ManagedIndexSchema create(String resourceName, SolrConfig config) {
+  public ManagedIndexSchema create(String resourceName, SolrConfig config, 
ConfigSetService configSetService) {
     this.resourceName = resourceName;

Review comment:
       *THREAD_SAFETY_VIOLATION:*  Unprotected write. Non-private method 
`ManagedIndexSchemaFactory.create(...)` writes to field `this.resourceName` 
outside of synchronization.
    Reporting because this access may occur on a background thread.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to