Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timer stealing without a concurrent data structure #3781

Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
8c68b69
First attempt at unsychronized timer heap
armanbilge Aug 8, 2023
3881a92
Refactor so timers can be canceled on same thread
armanbilge Aug 31, 2023
8bb7da7
Cancel at most once on owning thread
armanbilge Sep 1, 2023
301be74
Merge branch 'series/3.5.x' into topic/timer-stealing-without-synchro…
armanbilge Sep 1, 2023
8397877
Remove `TimerSkipList`
armanbilge Sep 1, 2023
4352294
Better handling of external sleeps
armanbilge Sep 1, 2023
7ae3761
`TimerNode` -> `Node`
armanbilge Sep 9, 2023
ac32fb2
Implement timer heap packing
armanbilge Sep 9, 2023
76b9e83
Add test for externally canceled timers
armanbilge Sep 9, 2023
2d19a69
Regenerate workflow
armanbilge Sep 10, 2023
b013c7e
Fix some tests
armanbilge Sep 11, 2023
8aca9e3
Workaround Scala 3 crash
armanbilge Sep 11, 2023
1d462fd
Formatting
armanbilge Sep 11, 2023
1a4a249
Only null callback if it is non-null
armanbilge Sep 17, 2023
7176530
`isCanceled` -> `isDeleted`
armanbilge Sep 17, 2023
37cb91f
Fix nanoTime-wrapping test
armanbilge Sep 17, 2023
1e1b82a
Delete dead code
armanbilge Sep 17, 2023
8d08a32
Use atomic `getAndSet` in `ExternalSleepCancel`
armanbilge Sep 17, 2023
e0c644c
Track cancelation in generic sleep
armanbilge Sep 17, 2023
fb465db
Make cancelation robust to unpublished callback
armanbilge Sep 17, 2023
0d1c55f
Merge remote-tracking branch 'upstream/series/3.5.x' into topic/timer…
armanbilge Sep 22, 2023
856b151
Fix NPE when canceling removed timer
armanbilge Sep 22, 2023
9d00ba0
Invalidate node index when removing
armanbilge Sep 22, 2023
bc8fcf9
Fix another NPE when canceling removed timer
armanbilge Sep 22, 2023
9411431
Merge remote-tracking branch 'upstream/series/3.5.x' into topic/timer…
armanbilge Sep 23, 2023
4a03e2f
Enable forking for `SleepDrift`
armanbilge Sep 23, 2023
74c92ae
Use `Arrays.copyOf`
armanbilge Sep 27, 2023
9f74fff
Remove branch from `overflowFree`
armanbilge Sep 27, 2023
c001d40
Add NOTICE
armanbilge Sep 27, 2023
04e54ea
Add overview scaladoc for `TimerHeap`
armanbilge Sep 27, 2023
80aeaae
Track externally deleted timers with counter
armanbilge Sep 27, 2023
19449a0
Revert "Track externally deleted timers with counter"
armanbilge Sep 27, 2023
6d0b285
Fix out-dated comment
armanbilge Oct 1, 2023
3059d71
Fix outdated comments
armanbilge Oct 1, 2023
87547e8
Track externally canceled timers with counter
armanbilge Oct 1, 2023
7492faa
Track cancel state atomically for generic sleep
armanbilge Oct 1, 2023
22ee156
Improve code comments
armanbilge Oct 1, 2023
29f3e4d
Optimize `TimerHeap` packing strategy
armanbilge Jan 13, 2024
a1bb5d0
Merge branch 'series/3.x' into topic/timer-stealing-without-synchroni…
armanbilge Feb 15, 2024
0856fa1
Regenerate workflow
armanbilge Feb 15, 2024
1908673
Bump copyright year
armanbilge Feb 19, 2024
02f1c9d
Handle exceptions in externally submitted sleeps
armanbilge Feb 19, 2024
0927d34
Account for possible null heap in TimerHeap#steal
armanbilge Feb 19, 2024
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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -609,5 +609,5 @@ jobs:
- name: Submit Dependencies
uses: scalacenter/sbt-dependency-submission@v2
with:
modules-ignore: cats-effect-benchmarks_3 cats-effect-benchmarks_2.12 cats-effect-benchmarks_2.13 cats-effect_3 cats-effect_2.12 cats-effect_2.13 cats-effect-stress-tests_3 cats-effect-stress-tests_2.12 cats-effect-stress-tests_2.13 cats-effect-example_sjs1_3 cats-effect-example_sjs1_2.12 cats-effect-example_sjs1_2.13 rootjs_3 rootjs_2.12 rootjs_2.13 ioapptestsnative_3 ioapptestsnative_2.12 ioapptestsnative_2.13 cats-effect-graalvm-example_3 cats-effect-graalvm-example_2.12 cats-effect-graalvm-example_2.13 cats-effect-tests_sjs1_3 cats-effect-tests_sjs1_2.12 cats-effect-tests_sjs1_2.13 rootjvm_3 rootjvm_2.12 rootjvm_2.13 rootnative_3 rootnative_2.12 rootnative_2.13 cats-effect-example_native0.4_3 cats-effect-example_native0.4_2.12 cats-effect-example_native0.4_2.13 cats-effect-example_3 cats-effect-example_2.12 cats-effect-example_2.13 cats-effect-tests_3 cats-effect-tests_2.12 cats-effect-tests_2.13 ioapptestsjvm_3 ioapptestsjvm_2.12 ioapptestsjvm_2.13 ioapptestsjs_3 ioapptestsjs_2.12 ioapptestsjs_2.13 cats-effect-tests_native0.4_3 cats-effect-tests_native0.4_2.12 cats-effect-tests_native0.4_2.13
modules-ignore: cats-effect-benchmarks_3 cats-effect-benchmarks_2.12 cats-effect-benchmarks_2.13 cats-effect_3 cats-effect_2.12 cats-effect_2.13 cats-effect-example_sjs1_3 cats-effect-example_sjs1_2.12 cats-effect-example_sjs1_2.13 rootjs_3 rootjs_2.12 rootjs_2.13 ioapptestsnative_3 ioapptestsnative_2.12 ioapptestsnative_2.13 cats-effect-graalvm-example_3 cats-effect-graalvm-example_2.12 cats-effect-graalvm-example_2.13 cats-effect-tests_sjs1_3 cats-effect-tests_sjs1_2.12 cats-effect-tests_sjs1_2.13 rootjvm_3 rootjvm_2.12 rootjvm_2.13 rootnative_3 rootnative_2.12 rootnative_2.13 cats-effect-example_native0.4_3 cats-effect-example_native0.4_2.12 cats-effect-example_native0.4_2.13 cats-effect-example_3 cats-effect-example_2.12 cats-effect-example_2.13 cats-effect-tests_3 cats-effect-tests_2.12 cats-effect-tests_2.13 ioapptestsjvm_3 ioapptestsjvm_2.12 ioapptestsjvm_2.13 ioapptestsjs_3 ioapptestsjs_2.12 ioapptestsjs_2.13 cats-effect-tests_native0.4_3 cats-effect-tests_native0.4_2.12 cats-effect-tests_native0.4_2.13
configs-ignore: test scala-tool scala-doc-tool test-internal
8 changes: 8 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cats-effect
Copyright 2020-2023 Typelevel
Copy link
Contributor

Choose a reason for hiding this comment

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

2024

Licensed under Apache License 2.0 (see LICENSE)

This software contains portions of code derived from scala-js
https://github.com/scala-js/scala-js
Copyright EPFL
Licensed under Apache License 2.0 (see LICENSE)
22 changes: 4 additions & 18 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ val nativeProjects: Seq[ProjectReference] =
val undocumentedRefs =
jsProjects ++ nativeProjects ++ Seq[ProjectReference](
benchmarks,
stressTests,
example.jvm,
graalVMExample,
tests.jvm,
Expand Down Expand Up @@ -394,8 +393,7 @@ lazy val rootJVM = project
std.jvm,
example.jvm,
graalVMExample,
benchmarks,
stressTests)
benchmarks)
.enablePlugins(NoPublishPlugin)

lazy val rootJS = project.aggregate(jsProjects: _*).enablePlugins(NoPublishPlugin)
Expand All @@ -419,7 +417,6 @@ lazy val kernel = crossProject(JSPlatform, JVMPlatform, NativePlatform)
ProblemFilters.exclude[Problem]("cats.effect.kernel.GenConcurrent#Memoize*")
)
)
.disablePlugins(JCStressPlugin)
.jsSettings(
libraryDependencies += "org.scala-js" %%% "scala-js-macrotask-executor" % MacrotaskExecutorVersion % Test
)
Expand Down Expand Up @@ -456,7 +453,6 @@ lazy val kernelTestkit = crossProject(JSPlatform, JVMPlatform, NativePlatform)
"cats.effect.kernel.testkit.TestContext#Task.copy")
)
)
.disablePlugins(JCStressPlugin)

/**
* The laws which constrain the abstractions. This is split from kernel to avoid jar file and
Expand All @@ -472,7 +468,6 @@ lazy val laws = crossProject(JSPlatform, JVMPlatform, NativePlatform)
"org.typelevel" %%% "cats-laws" % CatsVersion,
"org.typelevel" %%% "discipline-specs2" % DisciplineVersion % Test)
)
.disablePlugins(JCStressPlugin)

/**
* Concrete, production-grade implementations of the abstractions. Or, more simply-put: IO. Also
Expand Down Expand Up @@ -668,6 +663,8 @@ lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
// #3787, internal utility that was no longer needed
ProblemFilters.exclude[MissingClassProblem]("cats.effect.Thunk"),
ProblemFilters.exclude[MissingClassProblem]("cats.effect.Thunk$"),
// #3781, replaced TimerSkipList with TimerHeap
ProblemFilters.exclude[MissingClassProblem]("cats.effect.unsafe.TimerSkipList*"),
// #3943, refactored internal private CallbackStack data structure
ProblemFilters.exclude[IncompatibleResultTypeProblem]("cats.effect.CallbackStack.push"),
ProblemFilters.exclude[DirectMissingMethodProblem](
Expand Down Expand Up @@ -882,7 +879,6 @@ lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
ProblemFilters.exclude[MissingClassProblem]("cats.effect.unsafe.QueueExecutorScheduler$")
)
)
.disablePlugins(JCStressPlugin)

/**
* Test support for the core project, providing various helpful instances like ScalaCheck
Expand All @@ -898,7 +894,6 @@ lazy val testkit = crossProject(JSPlatform, JVMPlatform, NativePlatform)
"org.specs2" %%% "specs2-core" % Specs2Version % Test
)
)
.disablePlugins(JCStressPlugin)

/**
* Unit tests for the core project, utilizing the support provided by testkit.
Expand Down Expand Up @@ -1050,7 +1045,6 @@ lazy val std = crossProject(JSPlatform, JVMPlatform, NativePlatform)
ProblemFilters.exclude[MissingClassProblem]("cats.effect.std.JavaSecureRandom$")
)
)
.disablePlugins(JCStressPlugin)

/**
* A trivial pair of trivial example apps primarily used to show that IOApp works as a practical
Expand Down Expand Up @@ -1084,20 +1078,12 @@ lazy val benchmarks = project
.dependsOn(core.jvm, std.jvm)
.settings(
name := "cats-effect-benchmarks",
fork := true,
javaOptions ++= Seq(
"-Dcats.effect.tracing.mode=none",
"-Dcats.effect.tracing.exceptions.enhanced=false"))
.enablePlugins(NoPublishPlugin, JmhPlugin)

lazy val stressTests = project
.in(file("stress-tests"))
.dependsOn(core.jvm, std.jvm)
.settings(
name := "cats-effect-stress-tests",
Jcstress / version := "0.16"
)
.enablePlugins(NoPublishPlugin, JCStressPlugin)

lazy val docs = project
.in(file("site-docs"))
.dependsOn(core.jvm)
Expand Down

This file was deleted.

Loading
Loading