vlingo-net / xoom-net-actors Goto Github PK
View Code? Open in Web Editor NEWType safe Actor Model toolkit for reactive concurrency and resiliency using C# and other .NET languages.
License: Mozilla Public License 2.0
Type safe Actor Model toolkit for reactive concurrency and resiliency using C# and other .NET languages.
License: Mozilla Public License 2.0
So the goal is to no having add that file manually to every project using vlingo-actors
This happens with the following line World.StartWithDefault("test-request-response-channel");
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: Method 'AndThenTo' in type 'Vlingo.Common.ResultCompletes`1' from assembly 'Vlingo.Actors, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
at Vlingo.Actors.Actor..ctor()
at Vlingo.Actors.PrivateRootActor..ctor()
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at Vlingo.Actors.ActorFactory.ActorFor(Stage stage, Actor parent, Definition definition, IAddress address, IMailbox mailbox, ISupervisor supervisor, ILogger logger)
at Vlingo.Actors.Stage.CreateRawActor(Definition definition, Actor parent, IAddress maybeAddress, IMailbox maybeMailbox, ISupervisor maybeSupervisor, ILogger logger)
The goal is to use new C#8 features like default interface implementation and nullable types which helps a lot porting java code to .net.
Implement Actor eviction based on:
The current implementation generates the code in the form:
LocalMessage<Node>
but this leads to many conflicts where for example we have a namespace clash with type name like for the type Vlingo.Wire.Node.Node
. The generated proxy LocalMessage<Node>
obviously doesn't compile if we have using Vlingo.Wire.Node
at the beginning of the file.
It would be much better and less error prone if instead of relying on using
directives we just put the full name spaces like
LocalMessage<Vlingo.Wire.Node.Node>
They are just proxy, so we don't care if this looks bad but at least it will work in every case. Now it's not working for many proxies that I have to fix manually.
For example a protocol like that:
public interface IEntity1
{
ICompletes<Entity1State> DefineWith(string name, int age);
ICompletes<Entity1State> Current { get; }
void ChangeName(string name);
void IncreaseAge();
}
Will not generate the correct handler for Current
property because they are not supported
Related to #66
Make changes according to this template
version: 0.0.{build}
image:
- Visual Studio 2019
- Ubuntu
configuration: Release
skip_commits:
message: /.*\[ci\-skip\].*/
before_build:
- dotnet restore src/Vlingo.UUID.sln
build:
project: src/Vlingo.UUID.sln
verbosity: minimal
publish_nuget: true
test_script:
- dotnet test src/Vlingo.UUID.Tests
deploy:
- provider: NuGet
api_key:
secure: keYt7U6hDEIBzKLfVMts/6deGh0bqJdcjhlO2mWEJ04SRIS0Y6+e3EjszsRqq5nJ
skip_symbols: true
artifact: /.*\.nupkg/
on:
branch: master
notifications:
- provider: Webhook
url: https://webhooks.gitter.im/e/2b56d1ca84637acb9ee8
method: POST
on_build_success: true
on_build_failure: true
on_build_status_changed: true
ConsoleLoger
seems unfinished. It doesn't take into account passed ConsoleLoggerPluginConfiguration
usage form JVM vlingo/xoom-actors@b301abc
Check out lattice Grid
for implementation
For anyone with a spare hour or so, this is a pretty simple contribution.
Support Task<T>
as a valid type in the ProxyGenerator
. Inside the ProxyGenerator
you will see the current Completes<T>
support, and this type can be added along side it pretty easily.
NOTE: Task<T>
will not be used for vlingo-net-platform internals or public APIs. We will continue to use Completes<T>
for core vlingo-net-platform protocols. Consumers will for sure want to use Task<T>
as a return type in their protocols. We will provide sufficient warnings in the docs regarding the use of Task<T>
, but some will think it's a great idea and insist on its support.
Today we crate the actor by the following way:
var definition =
Definition.Has<InboundStreamActor>(Definition.Parameters(interest, addressType, reader, probeInterval),$"{inboundName}-inbound");
var inboundStream = stage.ActorFor<IInboundStream>(definition);
The goal would be to create the actor in the type-safe manner. Why ? Because it easier to be guided by the compiler what parameters to pass in the actor based on the type of actor. Instead we could do the following
var inboundStream = stage.ActorFor<IInboundStream>(() => new InboundStreamActor(interest, addressType, reader, probeInterval),$"{inboundName}-inbound"))
For that we would need to leverage creation through expressions like:
ActorFor<TActor>(Expression<Func<TActor>> factor)
For reference on JVM implementation (for impacted files rather than implementation details) : vlingo/xoom-actors@141f31b
I have noticed that there is still a slight issue as it comes to the execution of the pipeline in the multi threaded environment. These are not blocking but the investigation should be done along with a fix to be sure that everything behaves consistently.
On CI server:
TestThatManyScheduleOnceDeliver
never completes. https://ci.appveyor.com/project/VlingoNetOwner/vlingo-net-actors/builds/28113803/testsTestThatTimeOutOccursForSideEffects
mail fail https://ci.appveyor.com/project/VlingoNetOwner/vlingo-net-actors/builds/28113878/testsLocally on Windows machine:
TestAfterAndThenCompletesForSideEffects
System.NullReferenceException : Object reference not set to an instance of an object.
at Vlingo.Actors.Tests.CompletesActorProtocolTest.TestAfterAndThenCompletesForSideEffects() in C:\Sources\GitHub\vlingo-net-actors\src\Vlingo.Actors.Tests\CompletesActorProtocolTest.cs:line 48
TestReturnsCompletesForSideEffects
freezesTestSupplierProtocol
freezesTestTwoArgConsumerProtocol
.I suspect those might be the problem of continuation not being executed immediately if the outcome is set for the main continuation.
Non generic interface with a generic method is not supported and fails at compilation. The example of the interface:
public interface IGenericMethod
{
void Handle<T>(string name, Action<T> consumer) where T : GenericHandler;
}
Generation of the proxy fails with the following error:
vlingo-net/actors[Debug]: vlingo-net/actors: Generating proxy for main: IGenericMethod
Dynamically generated class source for Vlingo.Actors.Tests.GenericMethod__Proxy did not compile because: The type or namespace name 'T' could not be found (are you missing a using directive or an assembly reference?)
at Vlingo.Common.Compiler.DynaCompiler.Compile(Input input)
vlingo-net/actors[Debug]: vlingo-net/actors: Generating proxy for test: IGenericMethod
Dynamically generated class source for Vlingo.Actors.Tests.GenericMethod__Proxy did not compile because: The type or namespace name 'T' could not be found (are you missing a using directive or an assembly reference?)
at Vlingo.Common.Compiler.DynaCompiler.Compile(Input input)
Actor proxy IGenericMethod not created for main or test: Actor proxy IGenericMethod not created because: Dynamically generated class source did not compile: Vlingo.Actors.Tests.GenericMethod__Proxy
at Vlingo.Actors.ActorProxy.TryGenerateCreate(Type protocol, Actor actor, IMailbox mailbox, String targetClassName, String lookupTypeName) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/ActorProxy.cs:line 91
at Vlingo.Actors.ActorProxy.CreateFor(Type protocol, Actor actor, IMailbox mailbox) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/ActorProxy.cs:line 45
at Vlingo.Actors.ActorProxy.CreateFor[T](Actor actor, IMailbox mailbox) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/ActorProxy.cs:line 19
at Vlingo.Actors.Stage.ActorProxyFor[T](Actor actor, IMailbox mailbox) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/Stage.cs:line 450
at Vlingo.Actors.Stage.ActorProtocolFor[T](Definition definition, Actor parent, IAddress maybeAddress, IMailbox maybeMailbox, ISupervisor maybeSupervisor, ILogger logger) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/Stage.cs:line 394
vlingo-net/actors[Error]: vlingo-net/actors: FAILED: Actor proxy IGenericMethod not created for main or test: Actor proxy IGenericMethod not created because: Dynamically generated class source did not compile: Vlingo.Actors.Tests.GenericMethod__Proxy
vlingo-net/actors[Error] [Exception]: Actor proxy IGenericMethod not created for main or test: Actor proxy IGenericMethod not created because: Dynamically generated class source did not compile: Vlingo.Actors.Tests.GenericMethod__Proxy
vlingo-net/actors[Error] [StackTrace]: at Vlingo.Actors.ActorProxy.TryGenerateCreate(Type protocol, Actor actor, IMailbox mailbox, String targetClassName, String lookupTypeName) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/ActorProxy.cs:line 91
at Vlingo.Actors.ActorProxy.CreateFor(Type protocol, Actor actor, IMailbox mailbox) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/ActorProxy.cs:line 45
at Vlingo.Actors.ActorProxy.CreateFor[T](Actor actor, IMailbox mailbox) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/ActorProxy.cs:line 19
at Vlingo.Actors.Stage.ActorProxyFor[T](Actor actor, IMailbox mailbox) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/Stage.cs:line 450
at Vlingo.Actors.Stage.ActorProtocolFor[T](Definition definition, Actor parent, IAddress maybeAddress, IMailbox maybeMailbox, ISupervisor maybeSupervisor, ILogger logger) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/Stage.cs:line 394
vlingo-net/actors[Error] [InnerException]: Actor proxy IGenericMethod not created because: Dynamically generated class source did not compile: Vlingo.Actors.Tests.GenericMethod__Proxy
vlingo-net/actors[Error] [InnerException-StackTrace]: at Vlingo.Actors.ActorProxy.TryGenerateCreate(Type protocol, Actor actor, IMailbox mailbox, ProxyGenerator generator, String targetClassName, String lookupTypeName) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/ActorProxy.cs:line 128
at Vlingo.Actors.ActorProxy.TryGenerateCreate(Type protocol, Actor actor, IMailbox mailbox, String targetClassName, String lookupTypeName) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/ActorProxy.cs:line 87
I was getting this error when installing the latest (0.3.4) version of Vlingo .net. I thought I might be doing something wrong, so I downloaded the demo app (Ping/Pong) and ran it and it worked fine. When I updated the NuGet to the latest (0.3.4) this error appeared when trying to run it, which is the same error I was getting when trying to run my code.
Stack trace:
Dynamically generated class source for Vlingo.Actors.Examples.PingPong.Pinger__Proxy did not compile because: The type or namespace name 'Common' does not exist in the namespace 'Vlingo' (are you missing an assembly reference?) at Vlingo.Common.Compiler.DynaCompiler.Compile(Input input) vlingo-net/actors: vlingo-net/actors: Generating proxy for test: IPinger Dynamically generated class source for Vlingo.Actors.Examples.PingPong.Pinger__Proxy did not compile because: The type or namespace name 'Common' does not exist in the namespace 'Vlingo' (are you missing an assembly reference?) at Vlingo.Common.Compiler.DynaCompiler.Compile(Input input) vlingo-net/actors: Actor instantiation failed because: Exception has been thrown by the target of an invocation. vlingo-net/actors [Exception]: Exception has been thrown by the target of an invocation. Actor instantiation failed because: Exception has been thrown by the target of an invocation. at Vlingo.Actors.Stage.CreateRawActor(Definition definition, Actor parent, IAddress maybeAddress, IMailbox maybeMailbox, ISupervisor maybeSupervisor, ILogger logger) at Vlingo.Actors.Stage.ActorProtocolFor[T](Definition definition, Actor parent, IAddress maybeAddress, IMailbox maybeMailbox, ISupervisor maybeSupervisor, ILogger logger) vlingo-net/actors [StackTrace]: at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean skipCheckThis, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions) at Vlingo.Actors.ActorFactory.ActorFor(Stage stage, Actor parent, Definition definition, IAddress address, IMailbox mailbox, ISupervisor supervisor, ILogger logger) at Vlingo.Actors.Stage.CreateRawActor(Definition definition, Actor parent, IAddress maybeAddress, IMailbox maybeMailbox, ISupervisor maybeSupervisor, ILogger logger) vlingo-net/actors: vlingo-net/actors: FAILED: Actor instantiation failed because: Exception has been thrown by the target of an invocation. vlingo-net/actors [Exception]: Actor instantiation failed because: Exception has been thrown by the target of an invocation. vlingo-net/actors [StackTrace]: at Vlingo.Actors.Stage.CreateRawActor(Definition definition, Actor parent, IAddress maybeAddress, IMailbox maybeMailbox, ISupervisor maybeSupervisor, ILogger logger) at Vlingo.Actors.Stage.ActorProtocolFor[T](Definition definition, Actor parent, IAddress maybeAddress, IMailbox maybeMailbox, ISupervisor maybeSupervisor, ILogger logger)
Push the async void usage down to the lowest possible component as a temporary implementation. Currently, async void
usages are found in mailbox dispatcher plugins. Looking at the usages, they should be moved down to the Backoff implementation for now as a temporary state. Later, when we using Task fully everywhere, usages of async void
should be removed and should only be allowed in top level consumer functions- which cannot return Tasks, but have to await on something.
Based on Java
Today when doing async/await inside the actor the mailbox is not suspended, meaning the actor can be delivered new message while async method is being processed. This may be problematic:
One option is to suspend mailbox while the asynchronous operation is ongoing. This has its own set of issues
World
's ResolveDynamic
should be consistent with Java dictionary semantics and when service cannot be resolved for various reasons it should not throw an exception but return null
value.
PackageLicenseUrl
is deprecated. Now we should use PackageLicenseFile
.
Also we need to update other properties like tags, etc.
Sometimes if interface method signatures contain parameter names like @object
, @event
, and all the reserved .NET names, the generated proxy won't compile.
Before generating the parameter name, the check has to be done in the "reserved" keyword list and eventually change the name of the generated parameter.
ActorFactory
doesn't take into account the types of parameters when creating an actor but only the number of the constructor parameters. For example those two constructors get mismatched:
public InMemoryJournalActor(IDispatcher<Dispatchable<TEntry, TState>> dispatcher)
=> _journal = new InMemoryJournal<T, TEntry, TState>(dispatcher, Stage.World);
public InMemoryJournalActor(IEnumerable<IDispatcher<Dispatchable<TEntry, TState>>> dispatchers)
=> _journal = new InMemoryJournal<T, TEntry, TState>(dispatchers, Stage.World);
The code responsible that needs to be fixed:
foreach (var ctor in definition.Type!.GetConstructors())
{
if (ctor.GetParameters().Length != definitionParameterCount)
continue;
actor = Start(ctor, address, definition, logger);
if(actor != null)
{
break;
}
}
I have this following error rising in vlingo-net-wire
System.ArgumentException: Actor proxy IResponseSenderChannel`1 not created for main or test: Actor proxy IResponseSenderChannel`1 not created because: Dynamically generated class source did not compile: Vlingo.Wire.Channel.ResponseSenderChannel__Proxy ---> System.ArgumentException: Actor proxy IResponseSenderChannel`1 not created because: Dynamically generated class source did not compile: Vlingo.Wire.Channel.ResponseSenderChannel__Proxy ---> System.ArgumentException: Dynamically generated class source did not compile: Vlingo.Wire.Channel.ResponseSenderChannel__Proxy
at at Vlingo.Common.Compiler.DynaCompiler.Compile(Input input)
at at Vlingo.Actors.ActorProxy.TryGenerateCreate(Type protocol, Actor actor, IMailbox mailbox, ProxyGenerator generator, String targetClassName)
--- End of inner exception stack trace ---
at at Vlingo.Actors.ActorProxy.TryGenerateCreate(Type protocol, Actor actor, IMailbox mailbox, ProxyGenerator generator, String targetClassName)
at at Vlingo.Actors.ActorProxy.TryGenerateCreate(Type protocol, Actor actor, IMailbox mailbox, String targetClassName)
--- End of inner exception stack trace ---
at at Vlingo.Actors.ActorProxy.TryGenerateCreate(Type protocol, Actor actor, IMailbox mailbox, String targetClassName)
at at Vlingo.Actors.ActorProxy.CreateFor(Type protocol, Actor actor, IMailbox mailbox)
at at Vlingo.Actors.ActorProxy.CreateFor[T](Actor actor, IMailbox mailbox)
at at Vlingo.Actors.Stage.ActorProxyFor[T](Actor actor, IMailbox mailbox)
at at Vlingo.Actors.Actor.SelfAs[T]()
at Vlingo.Wire.Channel.SocketChannelSelectionProcessorActor..ctor(IRequestChannelConsumerProvider provider, String name, Int32 maxBufferPoolSize, Int32 messageBufferSize, Int64 probeInterval) in /Users/tjaskula/Documents/GitHub/vlingo-net-wire/src/Vlingo.Wire/Channel/SocketChannelSelectionProcessorActor.cs:46
has to be investigated.
Current queues are aligned on Java names and implementations but it doesn't make much sense for .NET Here I some considerations to take into account:
BoundedQueue
MPMCQueue
it should work in MPSC configurationI would keep for now ConcurrentQueue
and SharedRingBuffer
If the parameter is generic (or return type) the concrete generic types should also be prefixed with the namespace.
This is what is actually generated IDispatcher<Dispatchable<T, TState>>
The should have Some.Namespace.IDispatcher<Some.Other.Namespace.Dispatchable<T, TState>>
instead
Related to #66
According to the following template
language: csharp
jobs:
include:
- os: linux
dotnet: 3.0.100
mono: none
- os: osx
osx_image: xcode11
dotnet: 3.0.100
mono: none
sudo: false # use the new container-based Travis infrastructure
script:
- dotnet restore ./src/Vlingo.UUID.sln;
dotnet build ./src/Vlingo.UUID.sln;
dotnet test ./src/Vlingo.UUID.Tests/Vlingo.UUID.Tests.csproj;
notifications:
slack: vlingo-platform-net:kwiEEBuUpRnz2rYYYstTBpXr
Todays serialization is using Newtonsoft.Json
but it would be better to move it to the existing plugin architecture.
Thus serialization could be parametrable and we could move to BinaryFormatter
or another kind of serialization.
Tests don't fail in local development machines, even when they are running in parallel. However, often they fail in AppVeyor. My guess- Thread related issues. We don't have enough data to conclude. The failures are not even reproducible. Here are two such recent failures:
Under some circumstances, especially when ISchedule
is defined as actor protocol for network channel probing with an interval of 1ms and timeout of 1ms. The ensuing of task is faster than the task running. The actor queue may go up to several millions messages and the runing process slows down.
Currently the Vlingo.Actors/Properties
class loads properties/settings from a vlingo-actors.properties
file. It needs to be modified to read from any standard configuration provider (such as App.config or Web.config). Please discuss your idea here before starting any implementation.
I'm not sure if the real problem is in TestKit but this exception I had while testing in Vlingo.Wire
. Needs to be investigated. @zpbappi if you have some suggestions I would be grateful here.
consoleLogger: Inbound stream listening: for 'mock'
Unhandled Exception:Unhandled Exception:Unhandled Exception:
Unhandled Exception:
Unhandled Exception:
Unhandled Exception:
Unhandled Exception:
Unhandled Exception:Unhandled Exception: System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
at Vlingo.Actors.TestKit.TestWorld.Track(IMessage message)
at Vlingo.Actors.Plugin.Mailbox.TestKit.TestMailbox.Send(IMessage message)
at Vlingo.Actors.Scheduled__Proxy.IntervalSignal(IScheduled scheduled, Object data)
at Vlingo.Common.Scheduler.SchedulerTask.Tick(Object data)
at System.Threading.TimerQueueTimer.<>c.<.cctor>b__22_0(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExeSystem.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Vlingo.Actors.TestKit.TestWorld.Track(IMessage message)
at Vlingo.Actors.Plugin.Mailbox.TestKit.TestMailbox.Send(IMessage message)
at Vlingo.Actors.Scheduled__Proxy.IntervalSignal(IScheduled scheduled, Object data)
at Vlingo.Common.Scheduler.SchedulerTask.Tick(Object data)
at System.Threading.TimerQueueTimer.<>c.<.cctor>b__22_0(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.TimerQueueTimer.CallCallback()
at System.Threading.TimerQueueTimer.Fire()
at System.Threading.TimerQueue.FireNextTimers()
at System.Threading.TimerQueue.AppDomainTimerCallback(Int32 id)System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
at Vlingo.Actors.TestKit.TestWorld.Track(IMessage message)
at Vlingo.Actors.Plugin.Mailbox.TestKit.TestMailbox.Send(IMessage message)
at Vlingo.Actors.Scheduled__Proxy.IntervalSignal(IScheduled scheduled, Object data)
at Vlingo.Common.Scheduler.SchedulerTask.Tick(Object data)
at System.Threading.TimerQueueTimer.<System.NullReferenceException: Object reference not set to an instance of an object.
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at System.Collections.Generic.Dictionary`2.ContainsKey(TKey key)
at Vlingo.Actors.TestKit.TestWorld.Track(IMessage message)
at Vlingo.Actors.Plugin.Mailbox.TestKit.TestMailbox.Send(IMessage message)
at Vlingo.Actors.Scheduled__Proxy.IntervalSignal(IScheduled scheduled, Object data)
at Vlingo.Common.Scheduler.SchedulerTask.Tick(Object data)
at System.Threading.TimerQueueTimer.<>c.<.cctor>b__22_0(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.TimerQueueTimer.CallCallback()
at System.Threading.TimerQueueTimer.Fire()
at System.Threading.TimerQueue.FireNextTimers()
at System.Threading.TimerQueue.AppDomainTimerCallback(Int32 id)System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at System.Collections.Generic.Dictionary`2.ContainsKey(TKey key)
at Vlingo.Actors.TestKit.TestWorld.Track(IMessage message)
at Vlingo.Actors.Plugin.Mailbox.TestKit.TestMailbox.Send(IMessage message)
at Vlingo.Actors.Scheduled__Proxy.IntervalSignal(IScheduled scheduled, Object data)
at Vlingo.Common.Scheduler.SchedulerTask.Tick(Object data)
at System.Threading.TimerQueueTimer.<>c.<.cctor>b__22_0(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.TimerQueueTimer.CallCallback()
at System.Threading.TimerQueueTimer.Fire()
at System.Threading.TimerQueueTimer.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
at Vlingo.Actors.TestKit.TestWorld.Track(IMessage message)
at Vlingo.Actors.Plugin.Mailbox.TestKit.Te>c.<.cctor>b__22_0(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.TimerQueueTimer.CallCallback()
at System.Threading.TimerQueueTimer.Fire()
at System.Threading.TimerQueue.FireNextTimers()
at System.Threading.TimerQueue.AppDomainTimerCallback(Int32 id)
System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at System.Collections.Generic.Dictionary`2.ContainsKey(TKey key)
at Vlingo.Actors.TestKit.TestWorld.Track(IMessage message)
Based on
Sometimes not enough using directives are added to the generated code so it doesn't compile. Here's one example:
using System;
using System.Collections.Generic;
using Vlingo.Actors;
using Vlingo.Common;
using Vlingo.Wire.Channel;
using System.Net.Sockets;
namespace Vlingo.Wire.Channel
{
public class ResponseSenderChannel__Proxy : IResponseSenderChannel<Socket>
{
private const string AbandonRepresentation1 = "Abandon(RequestResponseContext<Socket>)";
private const string RespondWithRepresentation2 = "RespondWith(RequestResponseContext<Socket>, IConsumerByteBuffer)";
private readonly Actor actor;
private readonly IMailbox mailbox;
public ResponseSenderChannel__Proxy(Actor actor, IMailbox mailbox)
{
this.actor = actor;
this.mailbox = mailbox;
}
public void Abandon(RequestResponseContext<Socket> context)
{
if(!actor.IsStopped)
{
Action<IResponseSenderChannel<Socket>> consumer = x => x.Abandon(context);
if(mailbox.IsPreallocated)
{
mailbox.Send(actor, consumer, null, AbandonRepresentation1);
}
else
{
mailbox.Send(new LocalMessage<IResponseSenderChannel<Socket>>(actor, consumer, AbandonRepresentation1));
}
}
else
{
actor.DeadLetters.FailedDelivery(new DeadLetter(actor, AbandonRepresentation1));
}
}
public void RespondWith(RequestResponseContext<Socket> context, IConsumerByteBuffer buffer)
{
if(!actor.IsStopped)
{
Action<IResponseSenderChannel<Socket>> consumer = x => x.RespondWith(context, buffer);
if(mailbox.IsPreallocated)
{
mailbox.Send(actor, consumer, null, RespondWithRepresentation2);
}
else
{
mailbox.Send(new LocalMessage<IResponseSenderChannel<Socket>>(actor, consumer, RespondWithRepresentation2));
}
}
else
{
actor.DeadLetters.FailedDelivery(new DeadLetter(actor, RespondWithRepresentation2));
}
}
}
}
It doesn't compile because IConsumerByteBuffer
has no namespace using directive on the top of the file.
There are other examples as well, when I had System.Net.Sockets.Socket
as proxy method parameter and using was not added
AccessSafely
should support a ReadingWith
signature that takes Action<T>
if one parameter can be passed in but without returning any value.
There are many calls to Thread.Sleep
which is not the best alternative in concurrent code.
Currently the Vlingo.Actors.ProxyGenerator
class has some limitations. We will need to enhance it to overcome these.
It cannot create a proxy for an inner interface contained within a class. It would create a source that would fail compilation by the Vlingo.Common.DynaCompiler.Compile()
public class MyClass
{
public interface IMyInterface
{
void DoSomething();
}
}
public class MyActor : Actor, MyClass.IMyInterface
{
public void DoSomething() { }
}
For the code above, the following setup will fail
var world = World.StartWithDefault("test-world");
// it fails in the line below
var actor = world.ActorFor<MyClass.IMyInterface>(Definition.Has<MyActor>(Definition.NoParameters, "actor"));
Assert.NotNull(actor);
It fails similarly if the interface is not inner, but it references to any inner type.
public class MyOuterClass
{
public class MyInnerClass
{
}
}
public interface IMyInterface
{
void DoSomethingWith(MyOuterClass.MyInnerClass obj);
}
public class MyActor : Actor, IMyInterface
{
public void DoSomethingWith(MyOuterClass.MyInnerClass obj) { }
}
For the code above, the following setup will fail
var world = World.StartWithDefault("test-world");
// it fails in the line below
var actor = world.ActorFor<IMyInterface>(Definition.Has<MyActor>(Definition.NoParameters, "actor"));
Assert.NotNull(actor);
Based on
Address already registered vlingo/xoom-actors@9c95350
It seems that when a proxy is generated with a generic method, a constraint is generated even if not necessary.
An example is the following line
public void Write<TSource>(string id, TState state, int stateVersion, Vlingo.Symbio.Store.State.IWriteResultInterest interest) where TSource :
The generic constraint where TSource :
is unfinished.
The original interface method is
void Write<TSource>(string id, TState state, int stateVersion, IWriteResultInterest interest);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.