Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a9791b1
fix: coordinated ShutdownInitiated after bid close tx broadcast is fi…
vertex451 Mar 10, 2026
15977fa
fix: test watchdog stop while witing for broadcast
vertex451 Mar 10, 2026
09dbce0
chore: reverted original log.Info for lease won
vertex451 Mar 11, 2026
b1a78b6
chore: commit to the broadcast once started
vertex451 Mar 12, 2026
85f8226
fix: added context.WithTimeout to the broadcast message
vertex451 Mar 13, 2026
3514dd1
Merge branch 'main' of github.com:akash-network/provider into artem/f…
vertex451 Mar 13, 2026
d4c2e18
fix: added default BroadcastTimeout
vertex451 Mar 13, 2026
914b5b6
fix: set cancel timeout to 12s
vertex451 Mar 13, 2026
baee021
Merge branch 'main' into artem/fix-bid-close-if-no-manfiest
troian Mar 20, 2026
3388a8e
Merge branch 'main' into artem/fix-bid-close-if-no-manfiest
Zblocker64 Mar 20, 2026
5643880
Merge branch 'main' into artem/fix-bid-close-if-no-manfiest
Zblocker64 Mar 20, 2026
199c391
fix: added broadcastTimeout validation
vertex451 Mar 20, 2026
a252e0c
Merge branch 'main' into artem/fix-bid-close-if-no-manfiest
vertex451 Mar 23, 2026
87728f3
Merge branch 'main' into artem/fix-bid-close-if-no-manfiest
Zblocker64 Mar 24, 2026
e404abd
Merge branch 'main' into artem/fix-bid-close-if-no-manfiest
Zblocker64 Mar 24, 2026
1bf9bf0
Merge branch 'main' into artem/fix-bid-close-if-no-manfiest
Zblocker64 Mar 25, 2026
a9a2bc4
Merge branch 'main' into artem/fix-bid-close-if-no-manfiest
vertex451 Mar 27, 2026
f4a01fa
Merge branch 'main' into artem/fix-bid-close-if-no-manfiest
Zblocker64 Apr 8, 2026
0cc9eb7
Merge branch 'main' into artem/fix-bid-close-if-no-manfiest
Zblocker64 Apr 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gateway/rest/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func newRouter(log log.Logger, addr sdk.Address, pclient provider.Client, ctxCon
authorizeProviderMiddleware,
requireOwner,
)
Comment thread
Zblocker64 marked this conversation as resolved.
Outdated

hostnameRouter := authedRouter.PathPrefix(apclient.HostnamePrefix).Subrouter()
hostnameRouter.HandleFunc(apclient.MigratePathPrefix,
migrateHandler(log, pclient.Hostname(), pclient.ClusterService())).
Expand Down
13 changes: 8 additions & 5 deletions manifest/watchdog.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,20 @@ func (wd *watchdog) run() {
ID: mtypes.MakeBidID(wd.leaseID.OrderID(), wd.sess.Provider().Address()),
Reason: mtypes.LeaseClosedReasonManifestTimeout,
}

return runner.NewResult(wd.sess.Client().Tx().BroadcastMsgs(wd.ctx, []sdk.Msg{msg}, aclient.WithResultCodeAsError()))
})
case err = <-wd.lc.ShutdownRequest():
}

wd.lc.ShutdownInitiated(err)
if runch != nil {
result := <-runch
if err := result.Error(); err != nil {
wd.log.Error("failed closing bid", "err", err)
select {
case result := <-runch:
if err := result.Error(); err != nil {
wd.log.Error("failed closing bid", "err", err)
}
case err = <-wd.lc.ShutdownRequest():
Comment thread
troian marked this conversation as resolved.
// we need this case to skip waiting on runch when stop() is called
}
}
wd.lc.ShutdownInitiated(err)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}
27 changes: 27 additions & 0 deletions manifest/watchdog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ type watchdogTestScaffold struct {
}

func makeWatchdogTestScaffold(t *testing.T, timeout time.Duration) (*watchdog, *watchdogTestScaffold) {
return makeWatchdogTestScaffoldWithBlocking(t, timeout, nil)
}

func makeWatchdogTestScaffoldWithBlocking(t *testing.T, timeout time.Duration, blockUntilRelease <-chan struct{}) (*watchdog, *watchdogTestScaffold) {
scaffold := &watchdogTestScaffold{}
scaffold.parentCh = make(chan struct{})
scaffold.doneCh = make(chan dtypes.DeploymentID, 1)
Expand All @@ -39,6 +43,9 @@ func makeWatchdogTestScaffold(t *testing.T, timeout time.Duration) (*watchdog, *

txClientMock := &clientmocks.TxClient{}
txClientMock.On("BroadcastMsgs", mock.Anything, mock.Anything, mock.Anything).Run(func(args mock.Arguments) {
if blockUntilRelease != nil {
<-blockUntilRelease
}
scaffold.broadcasts <- args.Get(1).([]sdk.Msg)
}).Return(&sdk.Result{}, nil)

Expand Down Expand Up @@ -72,6 +79,7 @@ func TestWatchdogTimeout(t *testing.T) {

msg := msgs[0].(*mvbeta.MsgCloseBid)
require.Equal(t, scaffold.leaseID, msg.ID.LeaseID())
require.Equal(t, mtypes.LeaseClosedReasonManifestTimeout, msg.Reason)

deploymentID := testutil.ChannelWaitForValue(t, scaffold.doneCh)
require.Equal(t, deploymentID, scaffold.leaseID.DeploymentID())
Expand Down Expand Up @@ -121,3 +129,22 @@ func TestWatchdogStopsOnParent(t *testing.T) {
deploymentID := testutil.ChannelWaitForValue(t, scaffold.doneCh)
require.Equal(t, deploymentID, scaffold.leaseID.DeploymentID())
}

func TestWatchdogStopWhileWaitingForBroadcast(t *testing.T) {
releaseCh := make(chan struct{})
wd, scaffold := makeWatchdogTestScaffoldWithBlocking(t, 100*time.Millisecond, releaseCh)

<-time.After(200 * time.Millisecond)
wd.stop()

select {
case <-wd.lc.Done():
case <-time.After(5 * time.Second):
t.Fatal("deadlock: stop() blocked while watchdog was waiting on broadcast")
}

close(releaseCh)

deploymentID := testutil.ChannelWaitForValue(t, scaffold.doneCh)
require.Equal(t, deploymentID, scaffold.leaseID.DeploymentID())
}
Loading