chr15m / chr15m/bugout

Unexpected crash of app using bugout

Open
#70 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
637
Forks
58
PR merge metrics
No merged PRs in 30d

Description

Hey , i have noticed this weird exception that crashes my app using bugout.

This happens on scenarios that network connectivity is under restoring its state back to online , for example after a laptop hibernation.

https://github.com/chr15m/bugout/blob/62ddbc85365fc508eddcb8d5ab3a35b3ed000712/index.js#L112

```
/home/t13/Documents/proj/app/node_modules/bugout/index.js:112
if (this.torrent.discovery.tracker) {
^

TypeError: Cannot read properties of null (reading 'tracker')
at Bugout._onTorrent (/home/t13/Documents/proj/app/node_modules/bugout/index.js:112:30)
at /home/t13/Documents/proj/app/node_modules/bugout/index.js:96:14
at /home/t13/Documents/proj/app/node_modules/bugout/index.js:505:15
at _onseed (/home/t13/Documents/proj/app/node_modules/webtorrent/index.js:364:41)
at /home/t13/Documents/proj/app/node_modules/webtorrent/index.js:358:9
at end (/home/t13/Documents/proj/app/node_modules/run-parallel/index.js:21:15)
at done (/home/t13/Documents/proj/app/node_modules/run-parallel/index.js:25:10)
at each (/home/t13/Documents/proj/app/node_modules/run-parallel/index.js:31:7)
at Torrent. (/home/t13/Documents/proj/app/node_modules/run-parallel/index.js:46:37)
at Object.onceWrapper (node:events:628:28)

Node.js v20.5.0
error Command failed with exit code 1.
```

Solution to that could be as easy as that :
```js
if (this?.torrent?.discovery?.tracker) {
```

Let me know your thoughts on this..

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in index.js around line 112 and trace the _onTorrent callback through the nearby code and callbacks shown in the stack trace. Reproduce or inspect the network-restoration scenario after laptop hibernation, then verify that a missing torrent discovery object no longer crashes the app and that existing behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend, networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.