Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

同步区块的时候timestamp异常 #50

Open
bobbyguo opened this issue Jun 9, 2018 · 5 comments
Open

同步区块的时候timestamp异常 #50

bobbyguo opened this issue Jun 9, 2018 · 5 comments
Labels

Comments

@bobbyguo
Copy link

bobbyguo commented Jun 9, 2018

14:46:00.221 INFO  [subscribe] - neb state: {"chainId":1,"protocolVersion":"/neb/1.0.0","tail":"fee9aa34652867c205621c923c87ff3320dc00746ee98c4f64edff2e8d1a04b4","version":"1.0.1"}
14:46:00.449 INFO  [subscribe] - top block: {"chainId":1,"coinbase":"n1dZZnqKGEkb1LHYsZRei1CH6DunTio1j1q","eventsRoot":"55ff21fb45f78608728ad157f2bb61f6d4c2ffce711f12246222dac8bd10ec92","hash":"fee9aa34652867c205621c923c87ff3320dc00746ee98c4f64edff2e8d1a04b4","height":411105,"miner":"n1Pv2z4fB8BfpvY2k9NYL6vJbqTp78pQNZj","nonce":0,"parentHash":"880d87e1c0b0bc1005ee85785b2320575590970de3509cf60dfa1aad1e6157a8","stateRoot":"e10015d8b747d6e677d8d22354bcdf35bbe3578cfc4a3445f47bec1b5562ae35","timestamp":1528555545,"transactions":[{"chainId":0,"contractAddress":"","from":"","gasLimit":"","gasPrice":"","gasUsed":"","hash":"e2b629ba57bcd012aba63953cf115bed4b78045405160719eb105348fb7a1c9c","nonce":0,"status":0,"timestamp":0,"to":"","type":"","value":""},{"chainId":0,"contractAddress":"","from":"","gasLimit":"","gasPrice":"","gasUsed":"","hash":"d6367017e3cf412584887c358add2321d0789fe462a8495603e066258b1d70ea","nonce":0,"status":0,"timestamp":0,"to":"","type":"","value":""},{"chainId":0,"contractAddress":"","from":"","gasLimit":"","gasPrice":"","gasUsed":"","hash":"6394dfa26459dcdc217f03cd081667d7cb9ba9638a441039955521e37488c271","nonce":0,"status":0,"timestamp":0,"to":"","type":"","value":""}],"txsRoot":"050b53b984b4f90f4baf98f7009395e835281d4cdf98a0a7a17b2381546ded04"}
14:46:00.920 INFO  [subscribe] - save tx=27df67525154fc1c30f91e691b0ce6ab56b9c8bbd951ea636350b9c29151c7cc
14:46:00.924 ERROR [subscribe] - 
### Error updating database.  Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '50399-12-04 14:56:48' for column 'timestamp' at row 1
### The error may involve io.nebulas.explorer.mapper.NebTransactionMapper.addNebTransaction-Inline
### The error occurred while setting parameters
### SQL: replace INTO `neb_transaction` (`hash`, `block_hash`, `block_height`, `tx_seq`, `from`, `to`, `status`, `value`,`nonce`, `timestamp`, `type`, `data`, `gas_price`, `gas_limit`, `gas_used`, `created_at`)         VALUES         (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
### Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '50399-12-04 14:56:48' for column 'timestamp' at row 1
; SQL []; Data truncation: Incorrect datetime value: '50399-12-04 14:56:48' for column 'timestamp' at row 1; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '50399-12-04 14:56:48' for column 'timestamp' at row 1
org.springframework.dao.DataIntegrityViolationException: 
### Error updating database.  Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '50399-12-04 14:56:48' for column 'timestamp' at row 1
### The error may involve io.nebulas.explorer.mapper.NebTransactionMapper.addNebTransaction-Inline
### The error occurred while setting parameters
### SQL: replace INTO `neb_transaction` (`hash`, `block_hash`, `block_height`, `tx_seq`, `from`, `to`, `status`, `value`,`nonce`, `timestamp`, `type`, `data`, `gas_price`, `gas_limit`, `gas_used`, `created_at`)         VALUES         (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
### Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '50399-12-04 14:56:48' for column 'timestamp' at row 1
; SQL []; Data truncation: Incorrect datetime value: '50399-12-04 14:56:48' for column 'timestamp' at row 1; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '50399-12-04 14:56:48' for column 'timestamp' at row 1
	at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:102)
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:82)
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:82)
	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
	at com.sun.proxy.$Proxy77.insert(Unknown Source)
	at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)
	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:57)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
	at com.sun.proxy.$Proxy81.addNebTransaction(Unknown Source)
	at io.nebulas.explorer.service.blockchain.NebTransactionService.addNebTransaction(NebTransactionService.java:43)
	at io.nebulas.explorer.jobs.DataConsensusJob.syncBlock(DataConsensusJob.java:165)
	at io.nebulas.explorer.jobs.DataConsensusJob.check(DataConsensusJob.java:107)
	at sun.reflect.GeneratedMethodAccessor142.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65)
	at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
	at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '50399-12-04 14:56:48' for column 'timestamp' at row 1
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3971)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2487)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858)
	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1197)
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
	at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46)
	at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
	at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)
	at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185)
	at sun.reflect.GeneratedMethodAccessor84.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
	... 21 common frames omitted
@bobbyguo
Copy link
Author

bobbyguo commented Jun 9, 2018

环境:mainnet
分支:master

@bobbyguo
Copy link
Author

bobbyguo commented Jun 9, 2018

DataConsensusJob.java
start line#142

NebTransaction nebTx = BlockHelper.buildNebTransaction(tx, blk, seq, convertData(typeEnum, tx.getData()));
                    if (StringUtils.isEmpty(nebTx.getGasUsed())) {
                        nebTx.setGasUsed("");
                        log.warn("gas used not found for tx hash {}", tx.getHash());
                        **//Just log the message? Is the data valid here?**
                    }
                    nebTransactionService.addNebTransaction(nebTx);
                    log.info("save tx={}", tx.getHash());

@jaymansfield
Copy link
Contributor

Does anyone have a solution to this?

I'm randomly getting the same error message for certain transactions.

@bobbyguo
Copy link
Author

@jmansfie I added the try catch block and just ignore these invalid data.

@qq29oo qq29oo added the TODO label Nov 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants
@bobbyguo @jaymansfield @qq29oo and others