You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/11/25 10:23:05 UTC

[GitHub] [shardingsphere] wsm12138 opened a new issue, #22413: NPE“Cannot invoke "String.length()" because "s" is null”

wsm12138 opened a new issue, #22413:
URL: https://github.com/apache/shardingsphere/issues/22413

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   2ca7035bc3b2fe91a595724687b115b85ba72204
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   ### Expected behavior
   no error
   ### Actual behavior
   ```
   ERROR] 2022-11-25 16:51:15.382 [Curator-SafeNotifyService-0] c.g.common.eventbus.EventBus.default - Exception thrown by subscriber method renew(org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.config.event.props.PropertiesChangedEvent) on subscriber org.apache.shardingsphere.mode.manager.cluster.coordinator.subscriber.ConfigurationChangedSubscriber@2f3a1831 when dispatching event: org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.config.event.props.PropertiesChangedEvent@4bda752f
   java.lang.NullPointerException: Cannot invoke "String.length()" because "s" is null
   	at java.base/java.io.StringReader.<init>(StringReader.java:51)
   	at org.yaml.snakeyaml.reader.StreamReader.<init>(StreamReader.java:56)
   	at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:457)
   	at org.apache.shardingsphere.infra.util.yaml.YamlEngine.unmarshal(YamlEngine.java:83)
   	at org.apache.shardingsphere.mode.metadata.persist.data.ShardingSphereDataPersistService.loadTableData(ShardingSphereDataPersistService.java:95)
   	at org.apache.shardingsphere.mode.metadata.persist.data.ShardingSphereDataPersistService.loadSchemaData(ShardingSphereDataPersistService.java:87)
   	at org.apache.shardingsphere.mode.metadata.persist.data.ShardingSphereDataPersistService.loadDatabaseData(ShardingSphereDataPersistService.java:74)
   	at org.apache.shardingsphere.mode.metadata.persist.data.ShardingSphereDataPersistService.load(ShardingSphereDataPersistService.java:61)
   	at java.base/java.util.Optional.flatMap(Optional.java:289)
   	at org.apache.shardingsphere.mode.metadata.MetaDataContexts.initShardingSphereData(MetaDataContexts.java:49)
   	at org.apache.shardingsphere.mode.metadata.MetaDataContexts.<init>(MetaDataContexts.java:45)
   	at org.apache.shardingsphere.mode.manager.ContextManager.newMetaDataContexts(ContextManager.java:444)
   	at org.apache.shardingsphere.mode.manager.ContextManager.alterProperties(ContextManager.java:489)
   	at org.apache.shardingsphere.mode.manager.cluster.coordinator.subscriber.ConfigurationChangedSubscriber.renew(ConfigurationChangedSubscriber.java:118)
   	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
   	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
   	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:87)
   	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:144)
   	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:72)
   	at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30)
   	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:67)
   	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:108)
   	at com.google.common.eventbus.EventBus.post(EventBus.java:212)
   	at org.apache.shardingsphere.infra.util.eventbus.EventBusContext.post(EventBusContext.java:51)
   	at java.base/java.util.Optional.ifPresent(Optional.java:178)
   	at org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.GovernanceWatcherFactory.lambda$watch$0(GovernanceWatcherFactory.java:59)
   	at org.apache.shardingsphere.mode.repository.cluster.zookeeper.ZookeeperRepository.lambda$watch$0(ZookeeperRepository.java:243)
   	at org.apache.curator.framework.recipes.cache.TreeCacheListenerWrapper.sendEvent(TreeCacheListenerWrapper.java:71)
   	at org.apache.curator.framework.recipes.cache.TreeCacheListenerWrapper.event(TreeCacheListenerWrapper.java:42)
   	at org.apache.curator.framework.recipes.cache.CuratorCacheListenerBuilderImpl$2.lambda$event$0(CuratorCacheListenerBuilderImpl.java:149)
   	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
   	at org.apache.curator.framework.recipes.cache.CuratorCacheListenerBuilderImpl$2.event(CuratorCacheListenerBuilderImpl.java:149)
   	at org.apache.curator.framework.recipes.cache.CuratorCacheImpl.lambda$putStorage$6(CuratorCacheImpl.java:287)
   	at org.apache.curator.framework.listen.MappingListenerManager.lambda$forEach$0(MappingListenerManager.java:92)
   	at org.apache.curator.framework.listen.MappingListenerManager.forEach(MappingListenerManager.java:89)
   	at org.apache.curator.framework.listen.StandardListenerManager.forEach(StandardListenerManager.java:89)
   	at org.apache.curator.framework.recipes.cache.CuratorCacheImpl.lambda$callListeners$9(CuratorCacheImpl.java:301)
   	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
   	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
   	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
   	at java.base/java.lang.Thread.run(Thread.java:833)
   ```
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   - server.yaml
   ```
   mode:
     type: Cluster
     repository:
       type: ZooKeeper
       props:
         namespace: 20221125_sysbench
         server-lists: 192.168.10.23:2181
         retryIntervalMilliseconds: 500
         timeToLiveSeconds: 60
         maxRetries: 3
         operationTimeoutMilliseconds: 500
   
   authority:
     users:
       - user: root@%
         password: root
       - user: sharding
         password: sharding
     privilege:
       type: ALL_PERMITTED
   #rules:
   #- !TRANSACTION
   #  defaultType: XA
   #  providerType: Atomikos
   #- !SQL_PARSER
   #  sqlCommentParseEnabled: true
   #  sqlStatementCache:
   #    initialCapacity: 2000
   #    maximumSize: 65535
   #  parseTreeCache:
   #    initialCapacity: 128
   #    maximumSize: 1024
   
   props:
   #  max-connections-size-per-query: 1
   #  kernel-executor-size: 16  # Infinite by default.
   #  proxy-frontend-flush-threshold: 128  # The default value is 128.
   #  proxy-hint-enabled: false
   #  sql-show: false
   #  check-table-metadata-enabled: false
   #  show-process-list-enabled: false
   #    # Proxy backend query fetch size. A larger value may increase the memory usage of ShardingSphere Proxy.
   #    # The default value is -1, which means set the minimum value for different JDBC drivers.
   #  proxy-backend-query-fetch-size: -1
   #  proxy-frontend-executor-size: 0 # Proxy frontend executor size. The default value is 0, which means let Netty decide.
   #    # Available options of proxy backend executor suitable: OLAP(default), OLTP. The OLTP option may reduce time cost of writing packets to client, but it may increase the latency of SQL execution
   #    # and block other clients if client connections are more than proxy-frontend-executor-size, especially executing slow SQL.
   #  proxy-backend-executor-suitable: OLAP
   #  proxy-frontend-max-connections: 0 # Less than or equal to 0 means no limitation.
   #  sql-federation-enabled: false
   #    # Available proxy backend driver type: JDBC (default), ExperimentalVertx
   #  proxy-backend-driver-type: JDBC
   #  proxy-mysql-default-version: 5.7.22 # In the absence of schema name, the default version will be used.
   #  proxy-default-port: 3307 # Proxy default port.
   #  proxy-netty-backlog: 1024 # Proxy netty backlog.
   
     proxy-frontend-database-protocol-type: "PostgreSQL"
     proxy-metadata-collector-enabled: true
   ```
   
   - config-.yaml
   ```
   databaseName: encrypt_db
   dataSources:
   
     ds_0:
       url: jdbc:postgresql://192.168.10.20:55555/test?serverTimezone=UTC&useSSL=false&loggerLevel=OFF
       username: test
       password: sss
       connectionTimeoutMilliseconds: 10000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 500
       minPoolSize: 1
   ```
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

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


[GitHub] [shardingsphere] zhaojinchao95 commented on issue #22413: NPE“Cannot invoke "String.length()" because "s" is null”

Posted by GitBox <gi...@apache.org>.
zhaojinchao95 commented on issue #22413:
URL: https://github.com/apache/shardingsphere/issues/22413#issuecomment-1327996938

   @wsm12138 Thank you for your feedback, i will check it.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] tuichenchuxin closed issue #22413: NPE“Cannot invoke "String.length()" because "s" is null”

Posted by GitBox <gi...@apache.org>.
tuichenchuxin closed issue #22413: NPE“Cannot invoke "String.length()" because "s" is null”
URL: https://github.com/apache/shardingsphere/issues/22413


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] zhaojinchao95 commented on issue #22413: NPE“Cannot invoke "String.length()" because "s" is null”

Posted by GitBox <gi...@apache.org>.
zhaojinchao95 commented on issue #22413:
URL: https://github.com/apache/shardingsphere/issues/22413#issuecomment-1328014412

   @tuichenchuxin Hi, Can you look this? Maybe this method logic has some problem : 
   
   ```
   private ShardingSphereTableData loadTableData(final String databaseName, final String schemaName, final String tableName) {
           String tableData = repository.getDirectly(ShardingSphereDataNode.getTablePath(databaseName, schemaName, tableName));
           YamlShardingSphereTableData yamlTableData = YamlEngine.unmarshal(tableData, YamlShardingSphereTableData.class);
           Map<Integer, YamlShardingSpherePartitionRowData> partitionRowsData = new TreeMap<>();
           for (String each : repository.getChildrenKeys(ShardingSphereDataNode.getTablePath(databaseName, schemaName, tableName))) {
               String partitionRows = repository.getDirectly(ShardingSphereDataNode.getTablePartitionRowsPath(databaseName, schemaName, tableName, each));
               partitionRowsData.put(Integer.parseInt(each), YamlEngine.unmarshal(partitionRows, YamlShardingSpherePartitionRowData.class));
           }
           yamlTableData.setPartitionRows(partitionRowsData);
           return new YamlShardingSphereTableDataSwapper().swapToObject(yamlTableData);
       }
   ```


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] tuichenchuxin commented on issue #22413: NPE“Cannot invoke "String.length()" because "s" is null”

Posted by GitBox <gi...@apache.org>.
tuichenchuxin commented on issue #22413:
URL: https://github.com/apache/shardingsphere/issues/22413#issuecomment-1333373088

   Fixed by #22539


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] TeslaCN commented on issue #22413: NPE“Cannot invoke "String.length()" because "s" is null”

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #22413:
URL: https://github.com/apache/shardingsphere/issues/22413#issuecomment-1333321130

   Hi @tuichenchuxin 
   Is there any progress? Could we finish this in 5.3.0?


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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