Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

fix: transport should not handle connection if upgradeInbound throws #32

Conversation

vasco-santos
Copy link
Member

@vasco-santos vasco-santos force-pushed the fix/transport-should-not-handle-connection-if-upgradeInbound-throws branch from 1322752 to aada16d Compare December 20, 2019 20:09
@vasco-santos vasco-santos force-pushed the fix/transport-should-not-handle-connection-if-upgradeInbound-throws branch from 5348933 to faf35c8 Compare December 30, 2019 15:08
@vasco-santos
Copy link
Member Author

@jacobheun I tried to do a dynamic import for the wrtc dependency, in order to get around the aegir seg fault issue. This solved the issue on lint, but not in the tests.

@jacobheun
Copy link

The segfault is happening after the tests have finished. I haven't been able to determine where it's coming from yet, but I can look into this more later this week.

@vasco-santos
Copy link
Member Author

yes, I think that it is the wrtc module. But I couldn't find a work around it

@vasco-santos vasco-santos force-pushed the fix/transport-should-not-handle-connection-if-upgradeInbound-throws branch from 9a62650 to 71a30b6 Compare December 7, 2020 12:38
@vasco-santos
Copy link
Member Author

After a small research, It's seem to crash with all node versions > 10 node-webrtc/node-webrtc#636

I added a process.exit() on the aegir post hook so that we can circumvent this issue for the time being. I will also create a follow up issue in this repo to address this.

With this, I will unblock all the outdated deps and open PRs

@@ -40,7 +41,21 @@ module.exports = ({ handler, upgrader }, options = {}) => {
const maConn = toConnection(channel, listener.__connections)
log('new inbound connection %s', maConn.remoteAddr)

const conn = await upgrader.upgradeInbound(maConn)
channel.on('signal', (signal) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This listener doesn't seem to be getting cleaned up anywhere. We need to make sure we're doing cleanup on the channel. I believe there is some code in the dialer that we should probably abstract out and reuse.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the remove listeners.

Regarding abstracting the dialer, I think the differences are significant enough to add complexity with abstraction. I tried some changes abstracting them, but I think it made things even more confusing. These event handlers with callbacks are always not clean 😖 I think I can change the dialer to removeAllListeners instead of providing the actual callback. With that, we can abstract a clean function that cleans all the listeners, but not sure if it is worth

Copy link

@jacobheun jacobheun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@vasco-santos vasco-santos merged commit 1711a7d into master Dec 11, 2020
@vasco-santos vasco-santos deleted the fix/transport-should-not-handle-connection-if-upgradeInbound-throws branch December 11, 2020 09:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants