Skip to content

Conversation

@ym
Copy link
Contributor

@ym ym commented Nov 5, 2025

e.g.

image

@ym
Copy link
Contributor Author

ym commented Nov 6, 2025

I can't seem to fix the segfault issue when closing PacketSource, and I can see that other people are having the same issue with GoPacket. I will move the Rx process to a separate process to avoid this issue.

@IDisposable
Copy link
Contributor

IDisposable commented Nov 6, 2025

I can't seem to fix the segfault issue when closing PacketSource, and I can see that other people are having the same issue with GoPacket. I will move the Rx process to a separate process to avoid this issue.

I would hate for us to spin up a process just for that! Can I take a gander and see if I can figure it out? There are some mutex issues I noted, but I haven't even tries to run this code... I might be able to find the issue once I do?

Can you give me the steps to make it segfault and/or the stack trace?

IPv6Static *IPv6StaticConfig `json:"ipv6_static,omitempty" required_if:"IPv6Mode=static"`

LLDPMode null.String `json:"lldp_mode,omitempty" one_of:"disabled,basic,all" default:"basic"`
LLDPMode null.String `json:"lldp_mode,omitempty" one_of:"disabled,rx_only,tx_only,rx_and_tx,basic,all" default:"rx_and_tx"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we remove ,basic,all here and shouldn't the default now be rx_only per comment about privacy concerns on line 57?

If we're now only taking the list of options in stores.ts line 64, do we need a config conversion that morphs basic and all to to rx_only and rx_and_tx (respectively), or do we not care, since the LLDP was never really implemented?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's kept here for backwards compatibility, if the value doesn't exist in one_off, an error will be thrown :-(

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we morph it over as we read it in (like I once did for en_US vs en-US?)

I did that in #961

@ym
Copy link
Contributor Author

ym commented Nov 6, 2025

Can you give me the steps to make it segfault and/or the stack trace?

I kinda fixed it, but the solution is quite dirty. If you come up with a cleaner approach, go for it.
I added the details in the latest commit message.

@IDisposable
Copy link
Contributor

Can you give me the steps to make it segfault and/or the stack trace?

I kinda fixed it, but the solution is quite dirty. If you come up with a cleaner approach, go for it. I added the details in the latest commit message.

Looks fine by me :)

@ym
Copy link
Contributor Author

ym commented Nov 10, 2025

I reverted the change to cacheKey, since ttlcache doesn’t handle struct keys properly. It seems to use the memory address (or another non-stable reference) as the key, which causes unexpected behavior.

nvm, it's stupid React key issue :-)

@ym ym marked this pull request as ready for review November 10, 2025 16:55
l.rxCtx, l.rxCancel = context.WithCancel(context.Background())
l.rxRunning = true

go l.doCapture(&logger)
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this mean that the go routine is running inside the lock from line 140? Shouldn't we put all the "setup" work in a distinct function and run that all under a defer unlock, call that setup, and then start the go routine?

Copy link
Contributor

@IDisposable IDisposable Nov 10, 2025

Choose a reason for hiding this comment

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

I created a PR #961 targeting your feat/lldp branch with a safer implementation of this code (in tx.go, rx.go, lldp.go) to make the locks and pointer ownership clearer.

}

if cancel != nil {
cancel()
Copy link
Contributor

Choose a reason for hiding this comment

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

Note to self: This cancels any previously running Tx loop. This code is idiomatically correct.

Copy link
Contributor

Choose a reason for hiding this comment

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

... made clearer in #961

IPv6Static *IPv6StaticConfig `json:"ipv6_static,omitempty" required_if:"IPv6Mode=static"`

LLDPMode null.String `json:"lldp_mode,omitempty" one_of:"disabled,basic,all" default:"basic"`
LLDPMode null.String `json:"lldp_mode,omitempty" one_of:"disabled,rx_only,tx_only,rx_and_tx,basic,all" default:"rx_and_tx"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we morph it over as we read it in (like I once did for en_US vs en-US?)

I did that in #961

l.rxCtx, l.rxCancel = context.WithCancel(context.Background())
l.rxRunning = true

go l.doCapture(&logger)
Copy link
Contributor

@IDisposable IDisposable Nov 10, 2025

Choose a reason for hiding this comment

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

I created a PR #961 targeting your feat/lldp branch with a safer implementation of this code (in tx.go, rx.go, lldp.go) to make the locks and pointer ownership clearer.

}

if cancel != nil {
cancel()
Copy link
Contributor

Choose a reason for hiding this comment

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

... made clearer in #961

@ym ym requested a review from IDisposable November 11, 2025 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants