[ 
https://issues.apache.org/jira/browse/YUNIKORN-948?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Peter Bacsko updated YUNIKORN-948:
----------------------------------
    Description: 
When running the unit tests, the following data race occurred:

{noformat}
==================
WARNING: DATA RACE
Write at 0x00c000398bd0 by goroutine 21:
  runtime.mapassign_faststr()
      /snap/go/8627/src/runtime/map_faststr.go:202 +0x0
  
github.com/apache/incubator-yunikorn-core/pkg/scheduler.TestGetSchedulerHealthStatusContext()
      
/home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/health_checker_test.go:100
 +0xc64
  testing.tRunner()
      /snap/go/8627/src/testing/testing.go:1259 +0x22f
  testing.(*T).Run·dwrap·21()
      /snap/go/8627/src/testing/testing.go:1306 +0x47

Previous read at 0x00c000398bd0 by goroutine 23:
  runtime.mapiterinit()
      /snap/go/8627/src/runtime/map.go:802 +0x0
  
github.com/apache/incubator-yunikorn-core/pkg/scheduler.(*PartitionContext).GetAppsByState()
      
/home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/partition.go:1079 
+0x186
  
github.com/apache/incubator-yunikorn-core/pkg/scheduler.(*PartitionContext).cleanupExpiredApps()
      
/home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/partition.go:1364 
+0x4f
  
github.com/apache/incubator-yunikorn-core/pkg/scheduler.partitionManager.cleanupExpiredApps()
      
/home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/partition_manager.go:154
 +0x64
  
github.com/apache/incubator-yunikorn-core/pkg/scheduler.partitionManager.Run·dwrap·45()
      
/home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/partition_manager.go:57
 +0x64

Goroutine 21 (running) created at:
  testing.(*T).Run()
      /snap/go/8627/src/testing/testing.go:1306 +0x726
  testing.runTests.func1()
      /snap/go/8627/src/testing/testing.go:1598 +0x99
  testing.tRunner()
      /snap/go/8627/src/testing/testing.go:1259 +0x22f
  testing.runTests()
      /snap/go/8627/src/testing/testing.go:1596 +0x7ca
  testing.(*M).Run()
      /snap/go/8627/src/testing/testing.go:1504 +0x9d1
  main.main()
      _testmain.go:197 +0x324

Goroutine 23 (running) created at:
  github.com/apache/incubator-yunikorn-core/pkg/scheduler.partitionManager.Run()
      
/home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/partition_manager.go:57
 +0x34b
  
github.com/apache/incubator-yunikorn-core/pkg/scheduler.(*ClusterContext).updateSchedulerConfig·dwrap·6()
      /home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/context.go:329 
+0x64
==================
--- FAIL: TestGetSchedulerHealthStatusContext (0.00s)
    testing.go:1152: race detected during execution of test
{noformat}

Let's use {{PartitionContext.AddApplication()}} which uses locking instead of 
directly manipulating the map.

  was:
When running the unit tests, the following data occurred:

{noformat}
==================
WARNING: DATA RACE
Write at 0x00c000398bd0 by goroutine 21:
  runtime.mapassign_faststr()
      /snap/go/8627/src/runtime/map_faststr.go:202 +0x0
  
github.com/apache/incubator-yunikorn-core/pkg/scheduler.TestGetSchedulerHealthStatusContext()
      
/home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/health_checker_test.go:100
 +0xc64
  testing.tRunner()
      /snap/go/8627/src/testing/testing.go:1259 +0x22f
  testing.(*T).Run·dwrap·21()
      /snap/go/8627/src/testing/testing.go:1306 +0x47

Previous read at 0x00c000398bd0 by goroutine 23:
  runtime.mapiterinit()
      /snap/go/8627/src/runtime/map.go:802 +0x0
  
github.com/apache/incubator-yunikorn-core/pkg/scheduler.(*PartitionContext).GetAppsByState()
      
/home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/partition.go:1079 
+0x186
  
github.com/apache/incubator-yunikorn-core/pkg/scheduler.(*PartitionContext).cleanupExpiredApps()
      
/home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/partition.go:1364 
+0x4f
  
github.com/apache/incubator-yunikorn-core/pkg/scheduler.partitionManager.cleanupExpiredApps()
      
/home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/partition_manager.go:154
 +0x64
  
github.com/apache/incubator-yunikorn-core/pkg/scheduler.partitionManager.Run·dwrap·45()
      
/home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/partition_manager.go:57
 +0x64

Goroutine 21 (running) created at:
  testing.(*T).Run()
      /snap/go/8627/src/testing/testing.go:1306 +0x726
  testing.runTests.func1()
      /snap/go/8627/src/testing/testing.go:1598 +0x99
  testing.tRunner()
      /snap/go/8627/src/testing/testing.go:1259 +0x22f
  testing.runTests()
      /snap/go/8627/src/testing/testing.go:1596 +0x7ca
  testing.(*M).Run()
      /snap/go/8627/src/testing/testing.go:1504 +0x9d1
  main.main()
      _testmain.go:197 +0x324

Goroutine 23 (running) created at:
  github.com/apache/incubator-yunikorn-core/pkg/scheduler.partitionManager.Run()
      
/home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/partition_manager.go:57
 +0x34b
  
github.com/apache/incubator-yunikorn-core/pkg/scheduler.(*ClusterContext).updateSchedulerConfig·dwrap·6()
      /home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/context.go:329 
+0x64
==================
--- FAIL: TestGetSchedulerHealthStatusContext (0.00s)
    testing.go:1152: race detected during execution of test
{noformat}

Let's use {{PartitionContext.AddApplication()}} which uses locking instead of 
directly manipulating the map.


> Data race in TestGetSchedulerHealthStatusContext 
> -------------------------------------------------
>
>                 Key: YUNIKORN-948
>                 URL: https://issues.apache.org/jira/browse/YUNIKORN-948
>             Project: Apache YuniKorn
>          Issue Type: Bug
>          Components: test - unit
>            Reporter: Peter Bacsko
>            Assignee: Peter Bacsko
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 0.12
>
>
> When running the unit tests, the following data race occurred:
> {noformat}
> ==================
> WARNING: DATA RACE
> Write at 0x00c000398bd0 by goroutine 21:
>   runtime.mapassign_faststr()
>       /snap/go/8627/src/runtime/map_faststr.go:202 +0x0
>   
> github.com/apache/incubator-yunikorn-core/pkg/scheduler.TestGetSchedulerHealthStatusContext()
>       
> /home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/health_checker_test.go:100
>  +0xc64
>   testing.tRunner()
>       /snap/go/8627/src/testing/testing.go:1259 +0x22f
>   testing.(*T).Run·dwrap·21()
>       /snap/go/8627/src/testing/testing.go:1306 +0x47
> Previous read at 0x00c000398bd0 by goroutine 23:
>   runtime.mapiterinit()
>       /snap/go/8627/src/runtime/map.go:802 +0x0
>   
> github.com/apache/incubator-yunikorn-core/pkg/scheduler.(*PartitionContext).GetAppsByState()
>       
> /home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/partition.go:1079 
> +0x186
>   
> github.com/apache/incubator-yunikorn-core/pkg/scheduler.(*PartitionContext).cleanupExpiredApps()
>       
> /home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/partition.go:1364 
> +0x4f
>   
> github.com/apache/incubator-yunikorn-core/pkg/scheduler.partitionManager.cleanupExpiredApps()
>       
> /home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/partition_manager.go:154
>  +0x64
>   
> github.com/apache/incubator-yunikorn-core/pkg/scheduler.partitionManager.Run·dwrap·45()
>       
> /home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/partition_manager.go:57
>  +0x64
> Goroutine 21 (running) created at:
>   testing.(*T).Run()
>       /snap/go/8627/src/testing/testing.go:1306 +0x726
>   testing.runTests.func1()
>       /snap/go/8627/src/testing/testing.go:1598 +0x99
>   testing.tRunner()
>       /snap/go/8627/src/testing/testing.go:1259 +0x22f
>   testing.runTests()
>       /snap/go/8627/src/testing/testing.go:1596 +0x7ca
>   testing.(*M).Run()
>       /snap/go/8627/src/testing/testing.go:1504 +0x9d1
>   main.main()
>       _testmain.go:197 +0x324
> Goroutine 23 (running) created at:
>   
> github.com/apache/incubator-yunikorn-core/pkg/scheduler.partitionManager.Run()
>       
> /home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/partition_manager.go:57
>  +0x34b
>   
> github.com/apache/incubator-yunikorn-core/pkg/scheduler.(*ClusterContext).updateSchedulerConfig·dwrap·6()
>       
> /home/bacskop/repos/incubator-yunikorn-core/pkg/scheduler/context.go:329 +0x64
> ==================
> --- FAIL: TestGetSchedulerHealthStatusContext (0.00s)
>     testing.go:1152: race detected during execution of test
> {noformat}
> Let's use {{PartitionContext.AddApplication()}} which uses locking instead of 
> directly manipulating the map.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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

Reply via email to