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

Jaydeepkumar Chovatia edited comment on CASSANDRA-14220 at 3/8/18 12:49 AM:
----------------------------------------------------------------------------

Here is the {{NullPointerException}} stack trace from the attached file 
reported by [~jmarhuen]
{quote}ava.lang.NullPointerException: null at 
org.apache.cassandra.cql3.UntypedResultSet$Row.getBoolean(UntypedResultSet.java:273)
 ~[apache-cassandra-3.11.1.jar:3.11.1] at 
org.apache.cassandra.schema.SchemaKeyspace.fetchKeyspaceParams(SchemaKeyspace.java:956)
 ~[apache-cassandra-3.11.1.jar:3.11.1] at 
org.apache.cassandra.schema.SchemaKeyspace.fetchKeyspace(SchemaKeyspace.java:943)
 ~[apache-cassandra-3.11.1.jar:3.11.1] at 
org.apache.cassandra.schema.SchemaKeyspace.fetchKeyspacesOnly(SchemaKeyspace.java:937)
 ~[apache-cassandra-3.11.1.jar:3.11.1] at 
org.apache.cassandra.schema.SchemaKeyspace.mergeSchema(SchemaKeyspace.java:1363)
 ~[apache-cassandra-3.11.1.jar:3.11.1] at 
org.apache.cassandra.schema.SchemaKeyspace.mergeSchemaAndAnnounceVersion(SchemaKeyspace.java:1342)
 ~[apache-cassandra-3.11.1.jar:3.11.1] at 
org.apache.cassandra.service.MigrationManager$1.runMayThrow(MigrationManager.java:567)
 ~[apache-cassandra-3.11.1.jar:3.11.1] at 
org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28) 
~[apache-cassandra-3.11.1.jar:3.11.1] at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
~[na:1.8.0_151] at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
~[na:1.8.0_151] at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
~[na:1.8.0_151] at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
[na:1.8.0_151] at 
org.apache.cassandra.concurrent.NamedThreadFactory.lambda$threadLocalDeallocator$0(NamedThreadFactory.java:81)
 [apache-cassandra-3.11.1.jar:3.11.1]
{quote}
Problem is when we try to get specific value from {{Row}} then it converts 
[object to primitive 
type|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/cql3/UntypedResultSet.java#L272]
 and if object is {{null}} then it will throw {{NullPointerException}}. One of 
the reason it is not seen at many paces is because at most of the places it 
checks for [data availability before doing actual 
fetch|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/db/SystemKeyspace.java#L512].
 
 Ideally client should always receive proper exception instead of just 
{{NullPointerException}}, so I've created following patch to take care of that, 
can somebody please review them?
||trunk||3.0||2.2||
|[patch|https://github.com/apache/cassandra/compare/trunk...jaydeepkumar1984:CASS-14220-trunk]|[patch|https://github.com/jaydeepkumar1984/cassandra/tree/CASS-14220-3.0]|[patch|https://github.com/apache/cassandra/compare/trunk...jaydeepkumar1984:CASS-14220-2.2]|
|[uTest|https://circleci.com/gh/jaydeepkumar1984/cassandra/28]|[uTest|https://circleci.com/gh/jaydeepkumar1984/cassandra/30]|[uTest|https://circleci.com/gh/jaydeepkumar1984/cassandra/33]|

I will analyze further to see why {{select}} is returning {{null}} in this 
particular case.


was (Author: chovatia.jayd...@gmail.com):
Here is the {{NullPointerException}} stack trace from the attached file 
reported by [~jmarhuen]  

{quote}

ava.lang.NullPointerException: null at 
org.apache.cassandra.cql3.UntypedResultSet$Row.getBoolean(UntypedResultSet.java:273)
 ~[apache-cassandra-3.11.1.jar:3.11.1] at 
org.apache.cassandra.schema.SchemaKeyspace.fetchKeyspaceParams(SchemaKeyspace.java:956)
 ~[apache-cassandra-3.11.1.jar:3.11.1] at 
org.apache.cassandra.schema.SchemaKeyspace.fetchKeyspace(SchemaKeyspace.java:943)
 ~[apache-cassandra-3.11.1.jar:3.11.1] at 
org.apache.cassandra.schema.SchemaKeyspace.fetchKeyspacesOnly(SchemaKeyspace.java:937)
 ~[apache-cassandra-3.11.1.jar:3.11.1] at 
org.apache.cassandra.schema.SchemaKeyspace.mergeSchema(SchemaKeyspace.java:1363)
 ~[apache-cassandra-3.11.1.jar:3.11.1] at 
org.apache.cassandra.schema.SchemaKeyspace.mergeSchemaAndAnnounceVersion(SchemaKeyspace.java:1342)
 ~[apache-cassandra-3.11.1.jar:3.11.1] at 
org.apache.cassandra.service.MigrationManager$1.runMayThrow(MigrationManager.java:567)
 ~[apache-cassandra-3.11.1.jar:3.11.1] at 
org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28) 
~[apache-cassandra-3.11.1.jar:3.11.1] at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
~[na:1.8.0_151] at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
~[na:1.8.0_151] at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
~[na:1.8.0_151] at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
[na:1.8.0_151] at 
org.apache.cassandra.concurrent.NamedThreadFactory.lambda$threadLocalDeallocator$0(NamedThreadFactory.java:81)
 [apache-cassandra-3.11.1.jar:3.11.1]
{quote}


Problem is when we try to get specific value from {{Row}} then it converts 
[object to primitive 
type|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/cql3/UntypedResultSet.java#L272]
 and if object is {{null}} then it will throw {{NullPointerException}}. One of 
the reason it is not seen at many paces is because at most of the places it 
checks for [data availability before doing actual 
fetch|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/db/SystemKeyspace.java#L512].
 
Ideally client should always receive proper exception instead of just 
{{NullPointerException}}, so I've created following patch to take care of that, 
can somebody please review it?

||trunk || 3.0 ||2.2 ||
|[patch| 
https://github.com/apache/cassandra/compare/trunk...jaydeepkumar1984:CASS-14220-trunk]
 |[patch| https://github.com/jaydeepkumar1984/cassandra/tree/CASS-14220-3.0] 
|[patch| 
https://github.com/apache/cassandra/compare/trunk...jaydeepkumar1984:CASS-14220-2.2]
 |
|[uTest|https://circleci.com/gh/jaydeepkumar1984/cassandra/28 ] 
|[uTest|https://circleci.com/gh/jaydeepkumar1984/cassandra/30 ] 
|[uTest|https://circleci.com/gh/jaydeepkumar1984/cassandra/33 ] |

I will analyze further to see why {{select}} is returning {{null}} in this 
particular case.

>  C* returns to the driver NullPointerException sometimes when creating a 
> keyspace
> ---------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-14220
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14220
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: C* version: 3.11.1
>            Reporter: Jaume M
>            Assignee: Jaydeepkumar Chovatia
>            Priority: Major
>         Attachments: node1_system.log, node2_system.log, node3_system.log
>
>
> This happening regular on the python driver CI and it's reasonable to assume 
> that C* is under heavy load when it happens. The CQL command sent is
> {code}
> CREATE KEYSPACE keyspace WITH replication " = {'class': 'SimpleStrategy', 
> 'replication_factor': 1}
> {code}
> or 
> {code}
> CREATE TABLE table_name (k INT, i INT, PRIMARY KEY(k, i))
> {code}
> The error the driver gets is
> {code}
> <Error from server: code=0000 [Server error] 
> message="java.lang.RuntimeException: java.util.concurrent.ExecutionException: 
> java.lang.NullPointerException">
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to