raimohanska / ourboard

An online whiteboard
Other
763 stars 58 forks source link

Error in log related to cloning the tutorial board #181

Closed raimohanska closed 3 years ago

raimohanska commented 3 years ago

Just tried the "clone tutorial board" feature from anonymous front page and it fails


Oct 17 23:49:06 r-board app/web.1 Creating non-empty board 8c6b9f2b-b594-44e6-8999-42c86584304b -> bootstrapping history
Oct 17 23:49:06 r-board app/web.1 Trying to join unknown board 8c6b9f2b-b594-44e6-8999-42c86584304b
Oct 17 23:49:06 r-board app/web.1 Purging board 8c6b9f2b-b594-44e6-8999-42c86584304b from memory

Also stumbled upon this:

Oct 17 05:52:54 r-board app/web.1 Creating non-empty board 32369c12-2d26-4513-a39b-7d776d606f72 -> bootstrapping history
Oct 17 05:52:54 r-board app/web.1 Trying to join board 32369c12-2d26-4513-a39b-7d776d606f72 on socket for board 24b18484-c64f-4b1f-8dbf-e6d7dd2426ab, board host www.ourboard.io local hostnames www.ourboard.io
Oct 17 05:52:54 r-board heroku/router at=info method=GET path="/socket/board/24b18484-c64f-4b1f-8dbf-e6d7dd2426ab" host=www.ourboard.io request_id=bff9c0e2-874b-44bd-b1c0-a44709465c40 fwd="5.23.174.180" dyno=web.1 connect=0ms service=282793ms status=101 bytes=129 protocol=https
Oct 17 05:52:55 r-board app/web.1 Purging board 24b18484-c64f-4b1f-8dbf-e6d7dd2426ab from memory
Oct 17 05:52:55 r-board app/web.1 Compacting 23 bundles into one for board 24b18484-c64f-4b1f-8dbf-e6d7dd2426ab
Oct 17 05:52:57 r-board app/web.1 Loading board default into memory
Oct 17 05:52:57 r-board app/web.1 Loaded board default at serial 5027 from snapshot at serial 4553 and 474 events after snapshot
Oct 17 05:52:57 r-board app/web.1 Board loaded into memory: default
Oct 17 05:52:57 r-board app/web.1 Loading board history for board default session at serial 5027
Oct 17 05:52:57 r-board app/web.1 Got board history for board default session at serial 5027
Oct 17 05:53:29 r-board heroku/router at=info method=GET path="/socket/board/default" host=www.ourboard.io request_id=c86d076e-99e6-4b87-ba31-59a793f4481b fwd="65.229.137.134" dyno=web.1 connect=0ms service=32616ms status=101 bytes=129 protocol=https
Oct 17 05:53:30 r-board app/web.1 Purging board default from memory
Oct 17 05:53:30 r-board app/web.1 Board default: Verified 3 bundles containing 5027 events => no need to compact
Oct 17 05:53:48 r-board app/web.1 Saving board 32369c12-2d26-4513-a39b-7d776d606f72
Oct 17 05:53:48 r-board app/web.1 Board save failed for board 32369c12-2d26-4513-a39b-7d776d606f72 /app/node_modules/pg-protocol/src/parser.ts:357
Oct 17 05:53:48 r-board app/web.1         : new DatabaseError(messageValue, length, name)
Oct 17 05:53:48 r-board app/web.1           ^
Oct 17 05:53:48 r-board app/web.1 error: duplicate key value violates unique constraint "board_event_pkey"
Oct 17 05:53:48 r-board app/web.1     at Parser.parseErrorMessage (/app/node_modules/pg-protocol/src/parser.ts:357:11)
Oct 17 05:53:48 r-board app/web.1     at Parser.handlePacket (/app/node_modules/pg-protocol/src/parser.ts:186:21)
Oct 17 05:53:48 r-board app/web.1     at Parser.parse (/app/node_modules/pg-protocol/src/parser.ts:101:30)
Oct 17 05:53:48 r-board app/web.1     at TLSSocket.<anonymous> (/app/node_modules/pg-protocol/src/index.ts:7:48)
Oct 17 05:53:48 r-board app/web.1     at TLSSocket.emit (node:events:369:20)
Oct 17 05:53:48 r-board app/web.1     at TLSSocket.emit (node:domain:470:12)
Oct 17 05:53:48 r-board app/web.1     at addChunk (node:internal/streams/readable:313:12)
Oct 17 05:53:48 r-board app/web.1     at readableAddChunk (node:internal/streams/readable:288:9)
Oct 17 05:53:48 r-board app/web.1     at TLSSocket.Readable.push (node:internal/streams/readable:227:10)
Oct 17 05:53:48 r-board app/web.1     at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
Oct 17 05:53:48 r-board app/web.1   length: 255,
Oct 17 05:53:48 r-board app/web.1   severity: 'ERROR',
Oct 17 05:53:48 r-board app/web.1   code: '23505',
Oct 17 05:53:48 r-board app/web.1   detail: 'Key (board_id, last_serial)=(32369c12-2d26-4513-a39b-7d776d606f72, 1) already exists.',
raimohanska commented 3 years ago

When I tried again it worked. So something unstable going on here. No idea about the duplicate key thing, but the "board not found" thing happens likely due to the client not waiting for an ack before loading the new board.

raimohanska commented 3 years ago

In 09b2c360e33bc4cbc2dbc4407ee9ab33d8eadbdb I fixed the "board not found" case by waiting for board.add.ack message before navigating to the newly created board.

raimohanska commented 3 years ago

The premature navigation issue can also explain the constraint violations in the log.

I'm pretty sure this one's tackled for now. Closing.