profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/ktoso/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Konrad `ktoso` Malawski ktoso We sell fruit. ¯\_(ツ)_/¯ I'm fine, thanks! Tokyo http://www.kto.so Concurrency & Distributed systems in Swift @ ; ex: Akka | Reactive Streams

apple/swift-evolution 12446

This maintains proposals for changes and user-visible enhancements to the Swift Programming Language.

git-commit-id/git-commit-id-maven-plugin 1216

Maven plugin which includes build-time git repository information into an POJO / *.properties). Make your apps tell you which version exactly they were built from! Priceless in large distributed deployments... :-)

apple/swift-cluster-membership 158

Distributed Membership Protocol implementations in Swift

apple/swift-service-discovery 156

A service discovery API for Swift.

apple/swift-distributed-tracing 51

Instrumentation library for Swift server applications

DougGregor/swift-evolution 34

This maintains proposals for changes and user-visible enhancements to the Swift Programming Language.

drexin/akka-io-file 30

An asynchronous file handling module for Akka IO

apple/swift-distributed-tracing-baggage 12

Minimal context propagation container with Logging

apple/swift-distributed-tracing-baggage-core 7

Minimal context propagation container

fridek/Angry-Browsers 7

Box2Dweb based port of Angry Birds

pull request commentakka/akka

fix: Race condition in LazySourceSpec

Test PASSed.

johanandren

comment created time in 29 minutes

Pull request review commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

 func main() async {         print(", response:", String(buffer: response2.body ?? ByteBuffer()))          try await channel.close()++        try await group.shutdownGracefully()

Lemme add the shutdown to the catch.

simonjbeaumont

comment created time in 39 minutes

issue commentdotnet/orleans

Cannot find generated GrainReference class for interface issue with 1.2.2 version

Thanks @ReubenBond, adding reference to Microsoft.Orleans.CodeGenerator.MSBuild package worked for me.

somnathnitb

comment created time in 40 minutes

pull request commentapple/swift-corelibs-foundation

SR-10689: Fix bugs of DataProtocol's firstRange(of:in:)/lastRange(of:in:).

@millenomi Thank you for your approval.

YOCKOW

comment created time in 43 minutes

pull request commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

@swift-nio-bot add to allowlist

simonjbeaumont

comment created time in an hour

Pull request review commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

 func main() async {         print(", response:", String(buffer: response2.body ?? ByteBuffer()))          try await channel.close()++        try await group.shutdownGracefully()

Yeah, you can't await in a defer. In this case, a do...catch is probably easier.

simonjbeaumont

comment created time in an hour

Pull request review commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

 extension EventLoopFuture {     } } +extension EventLoopGroup {+    /// Shuts down the event loop gracefully.+    @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)+    @inlinable+    public func shutdownGracefully() async throws {+        return try await withCheckedThrowingContinuation { cont in+            self.shutdownGracefully { error in+                if let error = error {+                    cont.resume(throwing: error)+                }+                cont.resume()

Of course, oops. I forgot the early-return/switch/else here. Total fail 😅.

simonjbeaumont

comment created time in an hour

Pull request review commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

 func main() async {         print(", response:", String(buffer: response2.body ?? ByteBuffer()))          try await channel.close()++        try await group.shutdownGracefully()

Yes, I noticed this.

I wasn't able able to use the defer shutdown with the async, and because the comments said it was safe to call shutdown twice, I thought the safest thing to do was to leave the top-level shutdown.

I'll move the group lifecycle into the async function, though as it's probably the right thing to do.

simonjbeaumont

comment created time in an hour

Pull request review commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

 func main() async {         print(", response:", String(buffer: response2.body ?? ByteBuffer()))          try await channel.close()++        try await group.shutdownGracefully()

This patch isn't quite right as we now shut the loop down twice. Can you move the existing event loop construction out of the top-level scope and into this async function instead?

simonjbeaumont

comment created time in an hour

Pull request review commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

 extension EventLoopFuture {     } } +extension EventLoopGroup {+    /// Shuts down the event loop gracefully.+    @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)+    @inlinable+    public func shutdownGracefully() async throws {+        return try await withCheckedThrowingContinuation { cont in+            self.shutdownGracefully { error in+                if let error = error {+                    cont.resume(throwing: error)+                }+                cont.resume()

Continuations must be resumed exactly once: this will fail in the event we hit the error path, as we'll resume twice.

simonjbeaumont

comment created time in an hour

created tagrsocket/rsocket-cpp

tagv2021.06.14.00

C++ implementation of RSocket

created time in an hour

PR opened akka/akka

fix: Race condition in LazySourceSpec

References #28689

Was using Source.fromPublisher so likely was racy with either the eager fetch of 16 elements because of async boundary vs the cancellation reaching the lazy source first.

Additional improvements verifying the matval failure used for lazySource and lazyFutureSource.

+19 -19

0 comment

1 changed file

pr created time in an hour

pull request commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

Can one of the admins verify this patch?

simonjbeaumont

comment created time in an hour

pull request commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

Can one of the admins verify this patch?

simonjbeaumont

comment created time in an hour

pull request commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

Can one of the admins verify this patch?

simonjbeaumont

comment created time in an hour

pull request commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

Can one of the admins verify this patch?

simonjbeaumont

comment created time in an hour

pull request commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

Can one of the admins verify this patch?

simonjbeaumont

comment created time in an hour

pull request commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

Can one of the admins verify this patch?

simonjbeaumont

comment created time in an hour

pull request commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

Can one of the admins verify this patch?

simonjbeaumont

comment created time in an hour

pull request commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

Can one of the admins verify this patch?

simonjbeaumont

comment created time in an hour

pull request commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

Can one of the admins verify this patch?

simonjbeaumont

comment created time in an hour

pull request commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

Can one of the admins verify this patch?

simonjbeaumont

comment created time in an hour

pull request commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

Can one of the admins verify this patch?

simonjbeaumont

comment created time in an hour

pull request commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

Can one of the admins verify this patch?

simonjbeaumont

comment created time in an hour

pull request commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

Can one of the admins verify this patch?

simonjbeaumont

comment created time in an hour

pull request commentapple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

Can one of the admins verify this patch?

simonjbeaumont

comment created time in an hour

PR opened apple/swift-nio

Add async implementation of EventLoopGroup.shutdownGracefully to _NIOConcurrency

Adds a new extension to EventLoopGroup in _NIOConcurrency to provide an asynchronous shutdownGracefully().

Motivation

Shutting down an event loop was special because it used a completion handler and executed on a DispatchQueue because there would be no event loop to use an EventLoopFuture.

Now we have the new Swift concurrency features, we can provide an async shutdownGracefully.

Fixes #1878.

Modifications

Adds EventLoopGroup.shutdownGracefully() async and some code to use it in NIOAsyncAwaitDemo.

There's no obvious way to ask an ELG if it has been shutdown but I made the following local-only changes to verify that this performs as expected:

diff --git a/Sources/NIO/EventLoop.swift b/Sources/NIO/EventLoop.swift
index d18a33dd..972b3b05 100644
--- a/Sources/NIO/EventLoop.swift
+++ b/Sources/NIO/EventLoop.swift
@@ -840 +840 @@ public final class MultiThreadedEventLoopGroup: EventLoopGroup {
-    private enum RunState {
+    public enum RunState {
@@ -852 +852 @@ public final class MultiThreadedEventLoopGroup: EventLoopGroup {
-    private var runState: RunState = .running
+    public var runState: RunState = .running
diff --git a/Sources/NIOAsyncAwaitDemo/main.swift b/Sources/NIOAsyncAwaitDemo/main.swift
index 97a9c0c3..f8b29ace 100644
--- a/Sources/NIOAsyncAwaitDemo/main.swift
+++ b/Sources/NIOAsyncAwaitDemo/main.swift
@@ -60,0 +61 @@ func main() async {
+        print("elg state: \(group.runState)")  // .running
@@ -61,0 +63,7 @@ func main() async {
+        print("elg state: \(group.runState)")  // .closed(nil)
+
+        /// This causes the following error:
+        /// ERROR: Cannot schedule tasks on an EventLoop that has already shut down. This will be upgraded to a forced crash in future SwiftNIO versions.
+        group.next().execute {
+            print("This will not execute.")
+        }
+19 -0

0 comment

2 changed files

pr created time in an hour

pull request commentapple/swift-collections

Add a priority queue implementation built on top of a min-max heap

I just spent a little time profiling a bit (as the benchmark runtime seems quite long compared to the C++ version referenced in the article linked to previously), there seems to be an issue with using swapAt: (probably the same issue discussed here) - I just did a simple measurement of PriorityQueue<Int> insert and could see around 7.5M transient allocations. Doing the simple change of manually doing the swapAt: like this in all places:

storage.swapAt(largestDescendantIdx, index)

changed to

let tmp = storage[index]
storage[index] = storage[largestDescendantIdx]
storage[largestDescendantIdx] = tmp

brought this test down to 165K transient allocations and the runtime was basically halved.

And the original benchmark went from: chart-old

to:

chart-new

Not sure if this is a known issue with the swapAt: method, but it seems a bit rough to force two memory allocations per swapAt: operation for a simple small value type.

Also, looking at the removeMax test, there is also a large amount of transient allocations with this backtrace, can't quite understand why though (haven't looked at any others yet).

image

AquaGeek

comment created time in an hour

issue commentakka/akka-samples

akka-sample-sharding-java crash on start

Not as simple as I thought, I noticed I was getting this in the log No downing-provider-class configured, manual cluster downing required

It turns out undoing my change and upgrading the project to Akka 2.6.15 fixes the issue completely.

antiquechrono

comment created time in an hour

issue commentjoe-ng/homebridge-dyson-link

DYSON GIVING ERROR

same problem:(

agowda76

comment created time in an hour