Michael,

Coverity flagged a line of code in CassandraSchema as a resource leak. Coverity 
noticed Hook.add returns an AutoCloseable, and this never gets closed.  

It seems to me that if you created 1,000 instances of CassandraSchema, there 
would be 1,000 entries on Hook.TRIMMED.handlers, and each would reference a 
CassandraSchema, preventing it from being garbage collected. Do you agree that 
this is a resource leak?

Julian


> Begin forwarded message:
> 
> From: [email protected]
> Subject: New Defects reported by Coverity Scan for Apache Calcite
> Date: November 3, 2016 at 9:18:36 AM PDT
> To: [email protected]
> 
> 
> Hi,
> 
> Please find the latest report on new defect(s) introduced to Apache Calcite 
> found with Coverity Scan.
> 
> 1 new defect(s) introduced to Apache Calcite found with Coverity Scan.
> 
> 
> New defect(s) Reported-by: Coverity Scan
> Showing 1 of 1 defect(s)
> 
> 
> ** CID 138163:  Resource leaks  (RESOURCE_LEAK)
> /cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSchema.java:
>  115 in 
> org.apache.calcite.adapter.cassandra.CassandraSchema.<init>(java.lang.String, 
> java.lang.String, java.lang.String, java.lang.String, 
> org.apache.calcite.schema.SchemaPlus, java.lang.String)()
> 
> 
> ________________________________________________________________________________________________________
> *** CID 138163:  Resource leaks  (RESOURCE_LEAK)
> /cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSchema.java:
>  115 in 
> org.apache.calcite.adapter.cassandra.CassandraSchema.<init>(java.lang.String, 
> java.lang.String, java.lang.String, java.lang.String, 
> org.apache.calcite.schema.SchemaPlus, java.lang.String)()
> 109         } catch (Exception e) {
> 110           throw new RuntimeException(e);
> 111         }
> 112         this.parentSchema = parentSchema;
> 113         this.name = name;
> 114     
>>>>    CID 138163:  Resource leaks  (RESOURCE_LEAK)
>>>>    Ignoring resource created by 
>>>> "org.apache.calcite.runtime.Hook.TRIMMED.add(this.new 
>>>> org.apache.calcite.adapter.cassandra.CassandraSchema.1())" leaks it.
> 115         Hook.TRIMMED.add(new Function<RelNode, Void>() {
> 116           public Void apply(RelNode node) {
> 117             CassandraSchema.this.addMaterializedViews();
> 118             return null;
> 119           }
> 120         });
> 
> 
> ________________________________________________________________________________________________________
> To view the defects in Coverity Scan visit, 
> https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRZSbhom32dlDl11LWEm9nX1GSvKD3jyAHW-2Fr0-2Bf0CMC8B0U7suqxV3BT15z-2FEszmrI-3D_imI2KYNsuEB01fwTN2GgVt7Zng1mYfKawcoWn3RVSCuZY4RTPkfDFQ2sNAlVCp7tMcvqqypSsWwh8zcNYzDsMmNS3UsrjeDLb-2B4agAn6wTVvOwTDRmy-2BrVeKvN8cOKAiAbrSBU7AdPoWmBEuL6DS34vNxNE-2Fe2fukq3sWSRQ-2F6krxur4Xh5yihZQwvT9qmnTKBGGOmZc9difA0b0phBrdQ-3D-3D
> 
> To manage Coverity Scan email notifications for "[email protected]", click 
> https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRbVDbis712qZDP-2FA8y06Nq4BoCAgQyGZbR5Ka-2BtqPkbMIRa0EKakQx2V3qCI3AQ17qSid0ChoOurTSf7RECs1gZeliKSiqSYFeQV5NHgws1sYYu5KfGgq-2FqD0AylqtLo7E-3D_imI2KYNsuEB01fwTN2GgVt7Zng1mYfKawcoWn3RVSCuZY4RTPkfDFQ2sNAlVCp7tDVLIe6k-2FBMuQbxB-2FDFhFvj615xGYQ4yE4-2FBMZZ-2F7GzvaPAYEgc6eOv7klwWEDlQ8lCV5wVQzaL3TEXC447UhTTjWjLKV0NDl9yrozt6Q-2Fu-2Fjm0ah6BUdAt-2BtEzIVfZK-2BngxhkISn5LRy2BKdbvevNA-3D-3D
> 

Reply via email to