darcys22 / godbledger

Accounting Software with GRPC endpoints and SQL Backends
https://www.godbledger.com/
GNU General Public License v3.0
480 stars 56 forks source link

Poor data causese godbledger to fatally crash #175

Closed darcys22 closed 2 years ago

darcys22 commented 2 years ago

Sending a poorly formatted transaction via GRPC results in a crash and shutdown. It should gracefully handle the error and continue to live

godbledger-server | time="2022-01-04 07:46:23" level=info msg="New gRPC client connected to GoDBLedger" addr="119.77.85.139:53626" prefix=rpc
godbledger-server | time="2022-01-04 07:46:23" level=info msg="Received New Add Transaction Request" Request=date:"2020-05-29T03:56:29 -10:00" description:"Amet reprehenderit pariatur eiusmod irure. Aliqua dolore nulla pariatur mollit laboris deserunt. Dolor sit excepteur eiusmod laboris ipsum duis occaecat. Magna sunt ipsum pariatur deserunt adipisicing sit ut. Commodo consequat cupidatat commodo sunt incididunt. Mollit do adipisicing qui reprehenderit esse eiusmod minim nulla. Lorem nulla veniam enim elit deserunt et adipisicing incididunt ad.\r\n" lines:{accountname:"Service1" description:"Amet reprehenderit pariatur eiusmod irure. Aliqua dolore nulla pariatur mollit laboris deserunt. Dolor sit excepteur eiusmod laboris ipsum duis occaecat. Magna sunt ipsum pariatur deserunt adipisicing sit ut. Commodo consequat cupidatat commodo sunt incididunt. Mollit do adipisicing qui reprehenderit esse eiusmod minim nulla. Lorem nulla veniam enim elit deserunt et adipisicing incididunt ad.\r\n" amount:-98011} lines:{accountname:"Cash" description:"Amet reprehenderit pariatur eiusmod irure. Aliqua dolore nulla pariatur mollit laboris deserunt. Dolor sit excepteur eiusmod laboris ipsum duis occaecat. Magna sunt ipsum pariatur deserunt adipisicing sit ut. Commodo consequat cupidatat commodo sunt incididunt. Mollit do adipisicing qui reprehenderit esse eiusmod minim nulla. Lorem nulla veniam enim elit deserunt et adipisicing incididunt ad.\r\n" amount:98011} prefix=rpc
godbledger-server | time="2022-01-04 07:46:23" level=error msg="parsing time "2020-05-29T03:56:29 -10:00": extra text: "T03:56:29 -10:00"" prefix=rpc
godbledger-server | time="2022-01-04 07:46:23" level=debug msg="Created Transaction" prefix=ledger transaction=&{c79vmjr7rddgp8ouqbr0 2022-01-04 07:46:23.116409214 +0000 UTC m=+34.806784979 0xc000185200 [65 109 101 116 32 114 101 112 114 101 104 101 110 100 101 114 105 116 32 112 97 114 105 97 116 117 114 32 101 105 117 115 109 111 100 32 105 114 117 114 101 46 32 65 108 105 113 117 97 32 100 111 108 111 114 101 32 110 117 108 108 97 32 112 97 114 105 97 116 117 114 32 109 111 108 108 105 116 32 108 97 98 111 114 105 115 32 100 101 115 101 114 117 110 116 46 32 68 111 108 111 114 32 115 105 116 32 101 120 99 101 112 116 101 117 114 32 101 105 117 115 109 111 100 32 108 97 98 111 114 105 115 32 105 112 115 117 109 32 100 117 105 115 32 111 99 99 97 101 99 97 116 46 32 77 97 103 110 97 32 115 117 110 116 32 105 112 115 117 109 32 112 97 114 105 97 116 117 114 32 100 101 115 101 114 117 110 116 32 97 100 105 112 105 115 105 99 105 110 103 32 115 105 116 32 117 116 46 32 67 111 109 109 111 100 111 32 99 111 110 115 101 113 117 97 116 32 99 117 112 105 100 97 116 97 116 32 99 111 109 109 111 100 111 32 115 117 110 116 32 105 110 99 105 100 105 100 117 110 116 46 32 77 111 108 108 105 116 32 100 111 32 97 100 105 112 105 115 105 99 105 110 103 32 113 117 105 32 114 101 112 114 101 104 101 110 100 101 114 105 116 32 101 115 115 101 32 101 105 117 115 109 111 100 32 109 105 110 105 109 32 110 117 108 108 97 46 32 76 111 114 101 109 32 110 117 108 108 97 32 118 101 110 105 97 109 32 101 110 105 109 32 101 108 105 116 32 100 101 115 101 114 117 110 116 32 101 116 32 97 100 105 112 105 115 105 99 105 110 103 32 105 110 99 105 100 105 100 117 110 116 32 97 100 46 13 10] [0xc0001fc460 0xc0001fc4d0]}
godbledger-server | time="2022-01-04 07:46:23" level=debug msg="Searching User in DB" prefix=MySQL
godbledger-server | time="2022-01-04 07:46:23" level=debug msg="Searching Currency in DB: USD" prefix=MySQL
godbledger-server | time="2022-01-04 07:46:23" level=debug msg="Searching Currency in DB: USD" prefix=MySQL
godbledger-server | time="2022-01-04 07:46:23" level=debug msg="Searching Account in DB" prefix=MySQL
godbledger-server | time="2022-01-04 07:46:23" level=debug msg="Searching Account in DB" prefix=MySQL
godbledger-server | time="2022-01-04 07:46:23" level=debug msg="Adding Transaction to DB" prefix=MySQL
godbledger-server | time="2022-01-04 07:46:23" level=debug msg="Query: 
godbledger-server |         INSERT INTO transactions(transaction_id, postdate, description, poster_user_id)
godbledger-server |             VALUES(?,?,?,?);
godbledger-server |     " prefix=MySQL
godbledger-server | time="2022-01-04 07:46:23" level=debug msg="ID = 0, affected = 1
godbledger-server | " prefix=MySQL
godbledger-server | time="2022-01-04 07:46:23" level=debug msg="Query: 
godbledger-server |             INSERT INTO transactions_body(transaction_id, body)
godbledger-server |                 VALUES(?,?);
godbledger-server |         " prefix=MySQL
godbledger-server | time="2022-01-04 07:46:23" level=debug msg="Txn Id: c79vmjr7rddgp8ouqbr0" prefix=MySQL
godbledger-server | time="2022-01-04 07:46:23" level=debug msg="ID = 0, affected = 1
godbledger-server | " prefix=MySQL
godbledger-server | time="2022-01-04 07:46:23" level=debug msg="Saving Long Description into extended table" prefix=MySQL
godbledger-server | time="2022-01-04 07:46:23" level=debug msg="Query: INSERT INTO splits(transaction_id, split_id, split_date, description, currency, amount) VALUES (?, ?, ?, ?, ?, ?),(?, ?, ?, ?, ?, ?)" prefix=MySQL
godbledger-server | time="2022-01-04 07:46:23" level=debug msg="NumberVals = 12" prefix=MySQL
godbledger-server | time="2022-01-04 07:46:23" level=debug msg="Adding Split to DB" prefix=MySQL
godbledger-server | time="2022-01-04 07:46:23" level=fatal msg="Error 1292: Incorrect datetime value: '0000-00-00' for column 'split_date' at row 1" prefix=MySQL
godbledger-server exited with code 1