This is an automated email from the ASF dual-hosted git repository.

wilfred-s pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 52aca855 [YUNIKORN-3360] Check allocation is present in requests map 
before rollback (#1130)
52aca855 is described below

commit 52aca855ccf51dacbb55525cc490130872f633e4
Author: Aditya Maheshwari <[email protected]>
AuthorDate: Tue Aug 18 14:08:18 2026 +1000

    [YUNIKORN-3360] Check allocation is present in requests map before rollback 
(#1130)
    
    As a safety check not only make sure the allocation exists on the
    allocations map but also on the request map when rolling back.
    
    Closes: #1130
    
    Signed-off-by: Wilfred Spiegelenburg <[email protected]>
---
 pkg/events/event_publisher_test.go   | 2 +-
 pkg/scheduler/objects/application.go | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/pkg/events/event_publisher_test.go 
b/pkg/events/event_publisher_test.go
index f9a81236..69f867ee 100644
--- a/pkg/events/event_publisher_test.go
+++ b/pkg/events/event_publisher_test.go
@@ -41,7 +41,7 @@ func TestCreateShimPublisher(t *testing.T) {
 // StartService() and stop() functions should not cause panic
 func TestServiceStartStopInternal(t *testing.T) {
        countPublisherGoroutines := func() int {
-               buf := make([]byte, 2*1024)
+               buf := make([]byte, 64*1024)
                n := runtime.Stack(buf, true)
                return strings.Count(string(buf[:n]), 
"(*eventPublisher).start.func1")
        }
diff --git a/pkg/scheduler/objects/application.go 
b/pkg/scheduler/objects/application.go
index d7d9ab68..a31bfba6 100644
--- a/pkg/scheduler/objects/application.go
+++ b/pkg/scheduler/objects/application.go
@@ -824,6 +824,10 @@ func (sa *Application) RollbackAllocation(allocKey string) 
(*resources.Resource,
                return nil, fmt.Errorf("cannot rollback allocation %s: 
application %s is in state %s", allocKey, sa.ApplicationID, sa.CurrentState())
        }
 
+       if sa.requests[allocKey] == nil {
+               return nil, fmt.Errorf("failed to locate ask with key %s for 
rollback", allocKey)
+       }
+
        ask := sa.allocations[allocKey]
        if ask == nil {
                return nil, fmt.Errorf("failed to locate allocation with key %s 
for rollback", allocKey)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to