Repository navigation
fix panic - #13562
fix panic#13562
Conversation
|
|
||
| func (d *fseventNotify) Close() error { | ||
| numberOfWatches.Add(int64(-len(d.stream.Paths))) | ||
| d.closeOnce.Do(func() { |
There was a problem hiding this comment.
I see there's also a Start() - should the closeOnce be reset in Start() (otherwise it won't be run again after restarting?)
(not sure if that scenario is possible)
Codecov Reportβ All modified and coverable lines are covered by tests. π’ Thoughts on this report? Let us know! |
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM
but left two comments / suggestions (perhaps adding the test would make sense for this PR).
|
|
||
| d.closeOnce = sync.Once{} |
There was a problem hiding this comment.
LOL, not a new problem, but now starting to wonder if either Start() should be protected too only run once π - calling start multiple times wouldn't work well
That's not a new problem though, but perhaps something to look into.
That made me wonder if there's cases where "create watcher" and "start watcher" should be separate; looks like it's used here, and calls Start immediately after NewWatcher (wondering if Start should be done as part of the constructor);
Lines 271 to 279 in bf86ba0
Although I guess it's nice to be able to construct a new watching without immediately starting it in some cases.
There was a problem hiding this comment.
Start could indeed take place in constructor.
Start is not expected to be ran after watched was closed (channels are closed)
There was a problem hiding this comment.
Yea, I was looking because otherwise calling start multiple times would append a new listener to the global var, and start a new goroutine
compose/pkg/watch/watcher_darwin.go
Line 84 in e224264
compose/pkg/watch/watcher_darwin.go
Line 90 in e224264
So yeah, probably could be merged into NewWatcher then; looks like that requires an interface change π€
Lines 38 to 40 in e224264
For a more "organic" approach an alternative could also be to remove the Close function, and make Start return a "cancel" / "close" function, so that it's clear to the caller that it must be closed after, i.e. something like;
close, err := watcher.Start()
// ....
defer close()Either way, that's an existing issue, and not something that's hit by the current code
|
|
||
| // Even a third time should be safe | ||
| err = watcher.Close() | ||
| assert.NilError(t, err) |
There was a problem hiding this comment.
Perhaps the test should also run Start after this, and try Close again?
38363d0 to
4ff9aa7
Compare
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM to address the immediate issue
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [docker/compose](https://github.com/docker/compose) | minor | `v5.0.2` β `v5.1.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>docker/compose (docker/compose)</summary> ### [`v5.1.0`](https://github.com/docker/compose/releases/tag/v5.1.0) [Compare Source](docker/compose@v5.0.2...v5.1.0) #### What's Changed ##### π Fixes - emit container status events after network reconnection (fixes [#​13524](docker/compose#13524)) by [@​MaheshThakur9152](https://github.com/MaheshThakur9152) in [#​13529](docker/compose#13529) - Fix potential nil pointer dereference in container event monitoring by [@​Nepomuk5665](https://github.com/Nepomuk5665) in [#​13551](docker/compose#13551) - compose: recreate container when mounted image digest changes by [@​ibrahimypr](https://github.com/ibrahimypr) in [#​13549](docker/compose#13549) - fix panic by [@​ndeloof](https://github.com/ndeloof) in [#​13562](docker/compose#13562) - Fix invalid path error when using OCI artifacts on Windows by [@​mikesir87](https://github.com/mikesir87) in [#​13574](docker/compose#13574) - fix: execute post\_start hooks in docker compose run by [@​veeceey](https://github.com/veeceey) in [#​13607](docker/compose#13607) - Fix panic when watch rebuilds without up by [@​maxproske](https://github.com/maxproske) in [#​13610](docker/compose#13610) ##### π§ Internal - fsnotify is set in Dockerfile by [@​ndeloof](https://github.com/ndeloof) in [#​13533](docker/compose#13533) - Dockerfile: update golangci-lint to v2.8.0 by [@​thaJeztah](https://github.com/thaJeztah) in [#​13535](docker/compose#13535) - replace some uses of strings.Split(N) for strings.Cut by [@​thaJeztah](https://github.com/thaJeztah) in [#​13542](docker/compose#13542) - Upgrade GitHub Actions to latest versions by [@​salmanmkc](https://github.com/salmanmkc) in [#​13546](docker/compose#13546) - pkg/compose: remove dependency on github.com/docker/buildx/driver by [@​thaJeztah](https://github.com/thaJeztah) in [#​13563](docker/compose#13563) - use Docker GitHub Builder to build and sign binaries and bin image by [@​crazy-max](https://github.com/crazy-max) in [#​13568](docker/compose#13568) - ci: fix bin-image job by [@​crazy-max](https://github.com/crazy-max) in [#​13569](docker/compose#13569) - pkg/compose: defaultNetworkSettings: refactor by [@​thaJeztah](https://github.com/thaJeztah) in [#​13580](docker/compose#13580) - pkg/compose: un-export consts by [@​thaJeztah](https://github.com/thaJeztah) in [#​13584](docker/compose#13584) - modernize some code by [@​thaJeztah](https://github.com/thaJeztah) in [#​13588](docker/compose#13588) ##### βοΈ Dependencies - update to go1.25.7 by [@​thaJeztah](https://github.com/thaJeztah) in [#​13573](docker/compose#13573) - build(deps): bump golang.org/x/sys from 0.40.0 to 0.41.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​13578](docker/compose#13578) - build(deps): bump go.yaml.in/yaml/v4 from 4.0.0-rc.3 to 4.0.0-rc.4 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​13541](docker/compose#13541) - migrate to moby modules by [@​thaJeztah](https://github.com/thaJeztah) in [#​13078](docker/compose#13078) #### New Contributors - [@​MaheshThakur9152](https://github.com/MaheshThakur9152) made their first contribution in [#​13529](docker/compose#13529) - [@​salmanmkc](https://github.com/salmanmkc) made their first contribution in [#​13546](docker/compose#13546) - [@​Nepomuk5665](https://github.com/Nepomuk5665) made their first contribution in [#​13551](docker/compose#13551) - [@​ibrahimypr](https://github.com/ibrahimypr) made their first contribution in [#​13549](docker/compose#13549) - [@​veeceey](https://github.com/veeceey) made their first contribution in [#​13607](docker/compose#13607) **Full Changelog**: <docker/compose@v5.0.2...v5.1.0> </details> --- ### Configuration π **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). π¦ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. β» **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. π **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4zNS4xIiwidXBkYXRlZEluVmVyIjoiNDMuMzUuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->
What I did
Related issue
fixes #13561
(not mandatory) A picture of a cute animal, if possible in relation to what you did