I have a project containing MVC and API. So right now my database is getting used every time when I reload page. So I am implementing Redis in both MVC and API. What I am doing is if the key is already present in redis than MVC will check it and fetch the data from there, and if not than it will send the request to API that will fetch the data from database and set it in Redis with a default time of 30 minutes.
This is my Redis Class library:
public class Redis{
static StreamWriter writer = new StreamWriter(#"C:\Temp\connectionLog.txt")
static ConnectionMultiplexer redisConnection = ConnectionMultiplexer.Connect("connectionstring",writer);
static readonly IDatabaseAsync dbConnection = redisConnection.GetDatabase();
public static async Task SetRecordAsync<T>(string recordId, T data, TimeSpan? timeSpan = null)//default 30 mins
{
var jsonData = JsonSerializer.Serialize(data);
if (timeSpan.HasValue)
{
await dbConnection.StringSetAsync(recordId, jsonData, timeSpan);
}
else
{
timeSpan = TimeSpan.FromMinutes(30);
await dbConnection.StringSetAsync(recordId, jsonData, timeSpan);
}
}
public static async Task<T> GetValueAsync<T>(string recordId)
{
var data = await dbConnection.StringGetAsync(recordId);
var jsonData = data.ToString();
if (jsonData is null)
{
return default(T);
}
return JsonSerializer.Deserialize<T>(jsonData);
}
public static async Task DeleteValueAsync(string recordId)
{
await dbConnection.KeyDeleteAsync(recordId);
}
public static async Task<bool> IsKeyNull(string recordId)
{
var value = await dbConnection.StringGetAsync(recordId);
var isNull = value.IsNullOrEmpty ? true : false;
return isNull;
}
}
Whats confusing me is the fact that when I using the method IsKeyNull(This method returns true because initially no key is present and hence no value) from the redis classs library then code is working fine:
//Code in API
if (await Redis.IsKeyNull(Constant.RedisConstants.XYZ))
{
var url = string.Format(ApiUrl.GetOnlineXYZCount, storeId);
result = await HttpClientHelper.GetHttpResponseMessage(url);
}
else
{
result.StatusCode = HttpStatusCode.OK;
result.Data = Redis.GetValueAsync<int>(Constant.RedisConstants.XYZ).GetAwaiter().GetResult();
}
But when it gets true in above condition then API is called and this code is being run:
//API
if(Redis.IsKeyNull(Constants.RedisConstants.XYZ).GetAwaiter().GetResult())
{
using (var uow = UnitOfWork)
{
var result = uow.Repository<Data.EntityFramework.Order>().Count(database query);
Task task = Redis.SetRecordAsync<int>(Constants.RedisConstants.Order, result);
task.Wait();
response.Result = result;
}
}
Now the above code creates the problem, when the code hit Redis.IsKeyNull(Constants.RedisConstants.XYZ).GetAwaiter().GetResult(), an error is thrown:
StackExchange.Redis.RedisConnectionException
HResult=0x80131500
Message=No connection is active/available to service this operation: GET Order; A blocking operation was interrupted by a call to WSACancelBlockingCall, mc: 1/1/0, mgr: 10 of 10 available, clientName: ASR-PC, IOCP: (Busy=2,Free=998,Min=4,Max=1000), WORKER: (Busy=1,Free=8190,Min=4,Max=8191), v: 2.1x.58.3xyz
Source=StackExchange.Redis
StackTrace:
at StackExchange.Redis.ConnectionMultiplexer.ThrowFailed[T](TaskCompletionSource`1 source, Exception unthrownException) in /_/src/StackExchange.Redis/ConnectionMultiplexer.cs:line 2777
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at RedisCache.DistributedCacheExtensions.<IsKeyNull>d__4.MoveNext() in RedisCache\DistributedCacheExtensions.cs:line 67
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at BusinessLogic.Services.Order.OrderService.GetOnlineOrderCount(Int32 storeId) in OrderService.cs:line 1846
at GetOnlineOrderCount(Int32 storeId) in Api\Controllers\Order\OrderController.cs:line 443
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
Inner Exception 1:
RedisConnectionException: SocketFailure on windows.net:6380/Subscription, Initializing/NotStarted, last: NONE, origin: ConnectedAsync, outstanding: 0, last-read: 10s ago, last-write: 10s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 10s ago, v: 2.x.58.3xyz
Inner Exception 2:
IOException: Unable to read data from the transport connection: A blocking operation was interrupted by a call to WSACancelBlockingCall.
Inner Exception 3:
SocketException: A blocking operation was interrupted by a call to WSACancelBlockingCall
The log I received from my redis connectivity is this(connectionLog.txt):
redis.redis.cache.windows.net:6380,syncTimeout=100000000,connectTimeout=100000000,password=*****,ssl=True,connectRetry=8
Connecting redis.cache.windows.net:6380/Interactive...
BeginConnect: redis.cache.windows.net:6380
1 unique nodes specified
Requesting tie-break from redis.cache.windows.net:6380 > __Booksleeve_TieBreak...
Allowing endpoints 1.03:46:40 to respond...
Awaiting task completion, IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=1,Free=8190,Min=4,Max=8191)
Configuring TLS
connection failed: redis.cache.windows.net:6380 (Subscription, SocketFailure): SocketFailure on redis.cache.windows.net:6380/Subscription, Initializing/NotStarted, last: NONE, origin: ConnectedAsync, outstanding: 0, last-read: 30s ago, last-write: 30s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 30s ago, v: 2.1.58.34321
> Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
> An existing connection was forcibly closed by the remote host
connection failed: redis.cache.windows.net:6380 (Interactive, SocketFailure): SocketFailure on redis.cache.windows.net:6380/Interactive, Initializing/NotStarted, last: NONE, origin: ConnectedAsync, outstanding: 0, last-read: 30s ago, last-write: 30s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 30s ago, v: 2.1.58.34321
> Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
> An existing connection was forcibly closed by the remote host
Finished awaiting tasks, IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=2,Free=8189,Min=4,Max=8191)
redis.cache.windows.net:6380 faulted: SocketFailure on redis.cache.windows.net:6380/Interactive, Initializing/NotStarted, last: NONE, origin: ConnectedAsync, outstanding: 0, last-read: 30s ago, last-write: 30s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 30s ago, v: 2.1.58.34321
Waiting for tiebreakers...
All tasks are already complete
redis.cache.windows.net:6380 failed to nominate (Faulted)
> SocketFailure on redis.cache.windows.net:6380/Interactive, Initializing/NotStarted, last: NONE, origin: ConnectedAsync, outstanding: 0, last-read: 30s ago, last-write: 30s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 30s ago, v: 2.1.58.34321
No masters detected
redis.cache.windows.net:6380: Standalone v3.0.0, master; keep-alive: 00:01:00; int: Connecting; sub: Connecting; not in use: DidNotRespond
redis.cache.windows.net:6380: int ops=0, qu=0, qs=0, qc=0, wr=0, socks=2; sub ops=0, qu=0, qs=0, qc=0, wr=0, socks=2
Circular op-count snapshot; int: 0 (0.00 ops/s; spans 10s); sub: 0 (0.00 ops/s; spans 10s)
Sync timeouts: 0; async timeouts: 0; fire and forget: 0; last heartbeat: -1s ago
resetting failing connections to retry...
retrying; attempts left: 7...
1 unique nodes specified
Requesting tie-break from redis.cache.windows.net:6380 > __Booksleeve_TieBreak...
Allowing endpoints 1.03:46:40 to respond...
Awaiting task completion, IOCP: (Busy=2,Free=998,Min=4,Max=1000), WORKER: (Busy=2,Free=8189,Min=4,Max=8191)
Finished awaiting tasks, IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=2,Free=8189,Min=4,Max=8191)
redis.cache.windows.net:6380 faulted: UnableToConnect on redis.cache.windows.net:6380/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 0s ago, last-write: 0s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 30s ago, v: 2.1.58.34321
Waiting for tiebreakers...
All tasks are already complete
redis-red
This is what my connection string looks like:
windows.net:6380,password=xyz=,ssl=True,abortConnect=False,connectTimeout=10000,connectRetry=8,syncTimeout=3000
I have an app streaming music to another phone via Bluetooth. The app decodes mp3 to pcm data and then sends it. The problem is the sound stutters sometimes, but plays ok other times. The play method looks like this:
public void Read()
{
System.Threading.Tasks.Task.Run(() =>
{
int _bufferSize;
AudioTrack _output;
_output = new AudioTrack(Android.Media.Stream.Music, 44100, ChannelOut.Stereo, Android.Media.Encoding.Pcm16bit,
10000, AudioTrackMode.Stream);
_output.Play();
byte[] myReadBuffer = new byte[1000];
//byte[] check = new byte[1];
System.Threading.Tasks.Task.Run(() =>
{
while (true)
{
try
{
mmInStream.Read(myReadBuffer, 0, myReadBuffer.Length);
_output.Write(myReadBuffer, 0, myReadBuffer.Length);
//mmOutStream.Write(check);
}
catch (System.IO.IOException ex)
{
System.Diagnostics.Debug.WriteLine("Input stream was disconnected", ex);
}
}
}).ConfigureAwait(false);
}).ConfigureAwait(false);
}
And after a while it stops and displays this:
02-03 19:08:58.019 W/AudioTrack( 3986): releaseBuffer() track 0xc5e2de00 disabled due to previous underrun, restarting
How would I fix this?
But then I just found out it plays OK when played from my Samsung A5 to better Samsung J7, but then it just stops, here is the log:
02-04 15:44:12.816 W/AudioTrack( 2299): releaseBuffer() track 0xc6fa9380 disabled due to previous underrun, restarting
Thread finished: <Thread Pool> #7
The thread 0x7 has exited with code 0 (0x0).
02-04 15:44:36.239 V/InputMethodManager( 2299): Starting input: tba=android.view.inputmethod.EditorInfo#37c869a nm : com.companyname.sharethemusic ic=null
02-04 15:44:36.239 D/InputMethodManager( 2299): startInputInner - Id : 0
02-04 15:44:36.240 I/InputMethodManager( 2299): startInputInner - mService.startInputOrWindowGainedFocus
02-04 15:44:36.248 D/InputTransport( 2299): Input channel constructed: fd=78
02-04 15:44:36.248 D/InputTransport( 2299): Input channel destroyed: fd=72
02-04 15:44:36.659 D/InputMethodManager( 2299): HSIFW - flag : 0 Pid : 2299
02-04 15:44:36.712 D/BluetoothSocket( 2299): close() this: android.bluetooth.BluetoothSocket#6b2de90, channel: 7, mSocketIS: android.net.LocalSocketImpl$SocketInputStream#c5befa8, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream#a1a6ac1mSocket: android.net.LocalSocket#c0c7266 impl:android.net.LocalSocketImpl#d0bf9a7 fd:java.io.FileDescriptor#2545e54, mSocketState: CONNECTED
02-04 15:44:36.723 D/BluetoothAdapter( 2299): disable()
02-04 15:44:38.062 D/BluetoothAdapter( 2299): onBluetoothStateChange: up=false
02-04 15:44:38.062 D/BluetoothAdapter( 2299): Bluetooth is turned off, stop adv
02-04 15:44:38.063 D/BluetoothAdapter( 2299): There are no active google scan apps, stop scan
02-04 15:44:38.090 D/BluetoothAdapter( 2299): ondisableBLE
02-04 15:44:38.090 D/BluetoothAdapter( 2299): There are no active google scan apps, stop scan
You could improve your code like following .
int buffsize = AudioTrack.GetMinBufferSize(8000, ChannelOut.Mono, Encoding.Pcm16bit);
_output = new AudioTrack(Android.Media.Stream.Music, 8000, ChannelOut.Mono, Android.Media.Encoding.Pcm16bit,
buffsize*4, AudioTrackMode.Stream);
I'm making a 3D game on unity, and want to add the energy increasing functionality.
I tried the below code which made my game stuck when trying to test on editor
void Start()
{
// to calculate time since player left app to be used for energy increment
currentTime = DateTime.Now.ToString();
lastTime = PlayerPrefs.GetString("lastTime", currentTime);
if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
{
timeDT = Convert.ToDateTime(currentTime , null);
CurrentTimeDT = Convert.ToDateTime(lastTime, null);
timeSpan = timeDT.Subtract(CurrentTimeDT);
timeDifference = int.Parse(timeSpan.TotalSeconds.ToString());
} else if (Application.platform == RuntimePlatform.WindowsEditor)
{
lastTime = lastTime.Substring(10);
currentTime = currentTime.Substring(10);
timeDT = DateTime.ParseExact(currentTime, "h:mm:ss tt" , null);
CurrentTimeDT = DateTime.ParseExact(lastTime,"h:mm:ss tt", null);
timeSpan = timeDT.Subtract(CurrentTimeDT);
timeDifference = int.Parse(timeSpan.TotalSeconds.ToString());
}
energy = PlayerPrefs.GetInt("energy", 5); //get last saved energy
energy += Mathf.Abs(timeDifference / 300); //add one energy every 5 minutes since the player left app
if (energy > 5) // the maximum energy amount
{
energy = 5;
}
I expected it to increase energy by 1 for each 5 minutes since the player left the game. But I got the unity program stuck with no any outputs. I tried building the game for android I got some logging from logcat.
08-21 04:15:52.153 1747-1760/? I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.Serv4Me.SlidingBall/com.unity3d.player.UnityPlayerActivity bnds=[8,618][149,848]} from uid 1000 on display 0
08-21 04:15:52.153 1747-1760/? V/WindowManager: addAppToken: AppWindowToken{2efb58cd token=Token{24ade64 ActivityRecord{c6b2ff7 u0 com.Serv4Me.SlidingBall/com.unity3d.player.UnityPlayerActivity t39}}} to stack=1 task=39 at 0
08-21 04:15:52.157 2042-2042/? W/ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1341 android.content.ContextWrapper.sendBroadcast:382 com.vphone.launcher.Stats.recordLaunch:129 com.vphone.launcher.Launcher.c:3766 com.vphone.launcher.Launcher.onClickAppShortcut:3718
08-21 04:15:52.161 1747-1770/? V/WindowManager: Adding window Window{28d195fc u0 Starting com.Serv4Me.SlidingBall} at 3 of 6 (after Window{759b336 u0 com.vphone.launcher/com.vphone.launcher.Launcher})
08-21 04:15:52.201 2042-2252/? W/ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.bindService:1770 android.content.ContextWrapper.bindService:539 com.google.android.gms.common.stats.zza.zza:-1 com.google.android.gms.common.stats.zza.zza:-1 com.google.android.gms.ads.identifier.AdvertisingIdClient.zzc:-1
--------- beginning of main
08-21 04:15:52.202 2042-2042/? D/yeshen: launcher onpause
08-21 04:15:52.231 1747-2657/? I/ActivityManager: Start proc 10837:com.Serv4Me.SlidingBall/u0a47 for activity com.Serv4Me.SlidingBall/com.unity3d.player.UnityPlayerActivity
08-21 04:15:52.242 10837-10837/? D/houdini: [10837] Initialize library(version: 5.0.7b_x.48396 RELEASE)... successfully.
08-21 04:15:52.543 10837-10837/? D/houdini: [10837] Added shared library /data/app/com.Serv4Me.SlidingBall-1/lib/arm/libmain.so for ClassLoader by Native Bridge.
08-21 04:15:52.619 1747-2032/? V/WindowManager: Adding window Window{5e10f3d u0 com.Serv4Me.SlidingBall/com.unity3d.player.UnityPlayerActivity} at 3 of 7 (before Window{28d195fc u0 Starting com.Serv4Me.SlidingBall})
08-21 04:15:52.654 1747-1760/? V/WindowManager: Adding window Window{3ef00883 u0 SurfaceView} at 3 of 8 (before Window{5e10f3d u0 com.Serv4Me.SlidingBall/com.unity3d.player.UnityPlayerActivity})
08-21 04:15:52.728 1747-1770/? I/ActivityManager: Displayed com.Serv4Me.SlidingBall/com.unity3d.player.UnityPlayerActivity: +526ms
08-21 04:15:52.728 1747-2034/? W/ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1327 com.android.server.InputMethodManagerService.hideCurrentInputLocked:1992 com.android.server.InputMethodManagerService.windowGainedFocus:2082 com.android.internal.view.IInputMethodManager$Stub.onTransact:221 com.android.server.InputMethodManagerService.onTransact:873
08-21 04:15:52.738 2042-2042/? D/yeshen: launcher onstop
08-21 04:15:52.738 2042-2042/? D/Tinker.DefaultAppLike: onTrimMemory level:20
08-21 04:15:52.741 2042-2277/? W/DebugConnManager: getNetworkInfo() on networkType 1
08-21 04:15:52.823 10837-10855/? I/Unity: SystemInfo CPU = ARMv7 VFPv3 NEON, Cores = 2, Memory = 2022mb
08-21 04:15:52.823 10837-10855/? I/Unity: SystemInfo ARM big.LITTLE configuration: 2 big (mask: 0x3), 0 little (mask: 0x0)
08-21 04:15:52.825 10837-10855/? I/Unity: ApplicationInfo com.Serv4Me.SlidingBall version 1.0 build 52251d08-2db4-4bc0-b627-11ed2dc44951
08-21 04:15:52.825 10837-10855/? I/Unity: Built from '2019.2/staging' branch, Version '2019.2.1f1 (ca4d5af0be6f)', Build type 'Release', Scripting Backend 'mono', CPU 'armeabi-v7a', Stripping 'Disabled'
08-21 04:15:53.267 10837-10855/? E/EGL_emulation: [eglGetConfigAttrib] Bad attribute idx 12513
08-21 04:15:53.267 10837-10855/? E/EGL_emulation: tid 10855: eglGetConfigAttrib(761): error 0x3004 (EGL_BAD_ATTRIBUTE)
08-21 04:15:53.267 10837-10855/? E/EGL_emulation: [eglGetConfigAttrib] Bad attribute idx 12514
08-21 04:15:53.267 10837-10855/? E/EGL_emulation: tid 10855: eglGetConfigAttrib(761): error 0x3004 (EGL_BAD_ATTRIBUTE)
08-21 04:15:53.267 10837-10855/? E/EGL_emulation: [eglGetConfigAttrib] Bad attribute idx 1
08-21 04:15:53.267 10837-10855/? E/EGL_emulation: tid 10855: eglGetConfigAttrib(761): error 0x3004 (EGL_BAD_ATTRIBUTE)
08-21 04:15:53.307 10837-10855/? D/Unity: GL_EXT_debug_marker GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_depth24 GL_OES_depth32 GL_OES_element_index_uint GL_OES_texture_float GL_OES_texture_float_linear GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_EXT_texture_format_BGRA8888 GL_APPLE_texture_format_BGRA8888 GL_OES_texture_half_float GL_EXT_robustness GL_OES_texture_half_float_linear GL_OES_packed_depth_stencil GL_OES_vertex_half_float GL_OES_texture_npot GL_OES_rgb8_rgba8 GL_EXT_color_buffer_float ANDROID_gles_max_version_3_1 GL_OES_vertex_array_object
08-21 04:15:54.693 7816-7869/? E/PlayCommon: [290] afxf.d(308): Failed to connect to server for server timestamp: java.net.UnknownHostException: Unable to resolve host "play.googleapis.com": No address associated with hostname
08-21 04:15:54.753 2690-2690/? W/ChimeraUtils: Non Chimera context
08-21 04:15:54.845 7816-7869/? I/PlayCommon: [290] afxf.d(124): Connecting to server: https://play.googleapis.com/play/log?format=raw&proto_v2=true
08-21 04:15:54.847 7816-7869/? E/PlayCommon: [290] afxf.d(287): Failed to connect to server: java.net.UnknownHostException: Unable to resolve host "play.googleapis.com": No address associated with hostname
08-21 04:15:58.283 1747-1817/? D/ConnectivityService: releasing NetworkRequest NetworkRequest [ id=58, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED] ]
08-21 04:15:58.290 2042-2344/? D/ConnectivityManager.CallbackHandler: CM callback handler got msg 524296
08-21 04:15:58.902 1747-2032/? W/SensorService: sensor 00000000 already enabled in connection 0xa15fb460 (ignoring)
I solved the problem by deleting the PlayerPrefs from both the editor and android device which has the wrong datetime string parse. hope this helps someone else.
Using Mono 4.6.1 and Xamarin Studio [Community] running on MBP with OSX 10.11.6
I have a Solution, with two projects; one is the .NET project, the other NUnit test project for the first. When I mock an interface which uses auto properties (using Moq or NSubstitute) it causes mono to crash (SIGSTOP) during debugging.
public interface IExample
{
string Name { get; }
}
[TestFixture]
public class Test
{
[Test]
public void TestCase()
{
var example = Substitute.For<IExample>();
example.Name.Returns("Hat");
Console.WriteLine(example.Name);
}
}
If I put a breakpoint on the first line which creates the example substitute the system waits as expected. If I step over that line after about 1-2 seconds the system crashes (details below). NB: Running the test causes the test to pass because it doesn't take long enough for the background failure to trigger.
Application Output of failure:
Loaded assembly: /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/AddIns/MonoDevelop.UnitTesting/NUnit2/NUnitRunner.exe
Loaded assembly: /Library/Frameworks/Mono.framework/Versions/4.6.1/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll
Loaded assembly: /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/AddIns/MonoDevelop.UnitTesting/NUnit2/nunit.core.interfaces.dll
Loaded assembly: /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/AddIns/MonoDevelop.UnitTesting/NUnit2/nunit.core.dll
Loaded assembly: /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/AddIns/MonoDevelop.UnitTesting/NUnit2/nunit.framework.dll
Loaded assembly: /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/AddIns/MonoDevelop.UnitTesting/NUnit2/nunit.util.dll
Loaded assembly: /Library/Frameworks/Mono.framework/Versions/4.6.1/lib/mono/gac/System.Runtime.Remoting/4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
Loaded assembly: /Library/Frameworks/Mono.framework/Versions/4.6.1/lib/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
Loaded assembly: /Library/Frameworks/Mono.framework/Versions/4.6.1/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089/System.Xml.dll
Loaded assembly: /Library/Frameworks/Mono.framework/Versions/4.6.1/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll
Thread started: #2
Loaded assembly: /Library/Frameworks/Mono.framework/Versions/4.6.1/lib/mono/gac/System.Core/4.0.0.0__b77a5c561934e089/System.Core.dll
Thread started: #3
Thread started: <Thread Pool> #4
Thread started: <Thread Pool> #5
Thread started: <Thread Pool> #6
Loaded assembly: /Library/Frameworks/Mono.framework/Versions/4.6.1/lib/mono/gac/System.Drawing/4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
Loaded assembly: /Library/Frameworks/Mono.framework/Versions/4.6.1/lib/mono/gac/nunit.util/2.4.8.0__96d09a1eb7f44a77/nunit.util.dll
Loaded assembly: /Library/Frameworks/Mono.framework/Versions/4.6.1/lib/mono/gac/nunit.core.interfaces/2.4.8.0__96d09a1eb7f44a77/nunit.core.interfaces.dll
Thread started: #7
Loaded assembly: /Users/jeremy.connor/dev/MonoAPBug/MonoAPBug.Tests/bin/Debug/MonoAPBug.Tests.dll
Thread started: EventPumpThread #8
Thread started: TestRunnerThread #9
Resolved pending breakpoint at 'Test.cs:13,1' to void MonoAPBug.Tests.Test.TestCase () [0x00001].
Loaded assembly: /Users/jeremy.connor/dev/MonoAPBug/MonoAPBug.Tests/bin/Debug/MonoAPBug.exe
Loaded assembly: /Users/jeremy.connor/dev/MonoAPBug/MonoAPBug.Tests/bin/Debug/NSubstitute.dll
Loaded assembly: /Library/Frameworks/Mono.framework/Versions/4.6.1/lib/mono/gac/System.ServiceModel/4.0.0.0__b77a5c561934e089/System.ServiceModel.dll
Loaded assembly: DynamicProxyGenAssembly2
Loaded assembly: DynamicProxyGenAssembly2
mono(10800,0xb0319000) malloc: *** error for object 0x77c2a0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Stacktrace:
Native stacktrace:
0 mono 0x00171e46 mono_handle_native_sigsegv + 342
1 mono 0x001c5091 sigabrt_signal_handler + 145
2 libsystem_platform.dylib 0x91d4579b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 libsystem_c.dylib 0x98fdcc38 abort + 156
5 libsystem_malloc.dylib 0x96e51292 free + 433
6 mono 0x0032b266 mono_error_cleanup + 102
7 mono 0x001a7bda type_commands_internal + 2970
8 mono 0x0019b97d debugger_thread + 5261
9 mono 0x003340ca inner_start_thread + 474
10 libsystem_pthread.dylib 0x96e06780 _pthread_body + 138
11 libsystem_pthread.dylib 0x96e066f6 _pthread_body + 0
12 libsystem_pthread.dylib 0x96e03f7a thread_start + 34
Debug info from gdb:
(lldb) command source -s 0 '/tmp/mono-gdb-commands.TQtGVg'
Executing commands in '/tmp/mono-gdb-commands.TQtGVg'.
(lldb) process attach --pid 10800
Process 10800 stopped
* thread #1: tid = 0x211a96, 0x9386f3ea libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_50b', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
frame #0: 0x9386f3ea libsystem_kernel.dylib`__psynch_cvwait + 10
libsystem_kernel.dylib`__psynch_cvwait:
-> 0x9386f3ea <+10>: jae 0x9386f3fa ; <+26>
0x9386f3ec <+12>: calll 0x9386f3f1 ; <+17>
0x9386f3f1 <+17>: popl %edx
0x9386f3f2 <+18>: movl 0xf8cdc2f(%edx), %edx
Executable module set to "/Library/Frameworks/Mono.framework/Versions/4.6.1/bin/mono".
Architecture set to: i386-apple-macosx.
(lldb) thread list
Process 10800 stopped
* thread #1: tid = 0x211a96, 0x9386f3ea libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_50b', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
thread #2: tid = 0x211a98, 0x9386f3ea libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
thread #3: tid = 0x211a9a, 0x938684d6 libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'Finalizer'
thread #4: tid = 0x211a9b, 0x9386fd5e libsystem_kernel.dylib`__workq_kernreturn + 10
thread #5: tid = 0x211a9c, 0x938707fa libsystem_kernel.dylib`kevent_qos + 10, queue = 'com.apple.libdispatch-manager'
thread #6: tid = 0x211a9d, 0x9386fcee libsystem_kernel.dylib`__wait4 + 10, name = 'Debugger agent'
thread #7: tid = 0x211aa1, 0x9386fd5e libsystem_kernel.dylib`__workq_kernreturn + 10
thread #8: tid = 0x211aa5, 0x9386fd5e libsystem_kernel.dylib`__workq_kernreturn + 10
thread #9: tid = 0x211aa8, 0x9386e852 libsystem_kernel.dylib`__accept + 10, name = 'tid_2507'
thread #10: tid = 0x211aa9, 0x9386f646 libsystem_kernel.dylib`__recvfrom + 10, name = 'tid_2b0b'
thread #11: tid = 0x211aaa, 0x9386f3ea libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_330b'
thread #12: tid = 0x211aab, 0x9386f3ea libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'Threadpool worker'
thread #13: tid = 0x211aac, 0x9386f3ea libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'Threadpool worker'
thread #14: tid = 0x211aad, 0x9386f3ea libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'Timer-Scheduler'
thread #15: tid = 0x211aaf, 0x9386f3ea libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'EventPumpThread'
thread #16: tid = 0x211ab0, 0x9386f3ea libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'TestRunnerThread'
(lldb) thread backtrace all
* thread #1: tid = 0x211a96, 0x9386f3ea libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_50b', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
* frame #0: 0x9386f3ea libsystem_kernel.dylib`__psynch_cvwait + 10
frame #1: 0x96e07538 libsystem_pthread.dylib`_pthread_cond_wait + 757
frame #2: 0x96e09276 libsystem_pthread.dylib`pthread_cond_wait$UNIX2003 + 71
frame #3: 0x0030a955 mono`mono_os_cond_timedwait [inlined] mono_os_cond_wait(cond=0x7a138238, mutex=0x7a13820c) + 12 at mono-os-mutex.h:107 [opt]
frame #4: 0x0030a949 mono`mono_os_cond_timedwait(cond=<unavailable>, mutex=<unavailable>, timeout_ms=<unavailable>) + 185 at mono-os-mutex.h:122 [opt]
frame #5: 0x0030a6cb mono`_wapi_handle_timedwait_signal_handle(handle=0x00001600, timeout=<unavailable>, alertable=<unavailable>, poll=<unavailable>, alerted=0xbff5e390) + 507 at handles.c:1555 [opt]
frame #6: 0x0030a4c8 mono`_wapi_handle_timedwait_signal(timeout=4294967295, poll=0, alerted=0xbff5e23c) + 56 at handles.c:1476 [opt]
frame #7: 0x0031eb5f mono`wapi_WaitForMultipleObjectsEx(numobjects=<unavailable>, handles=<unavailable>, waitall=<unavailable>, timeout=<unavailable>, alertable=<unavailable>) + 1775 at wait.c:620 [opt]
frame #8: 0x002673d4 mono`mono_thread_manage [inlined] wait_for_tids_or_state_change(timeout=4294967295) + 82 at threads.c:3053 [opt]
frame #9: 0x00267382 mono`mono_thread_manage + 322 at threads.c:3258 [opt]
frame #10: 0x00138dc7 mono`mono_main(argc=<unavailable>, argv=<unavailable>) + 8855 at driver.g.c:2187 [opt]
frame #11: 0x000a4141 mono`main [inlined] mono_main_with_options(argc=6, argc=6, argc=6, argv=0xbff5e944, argv=0xbff5e944, argv=0xbff5e944) + 33 at main.c:28 [opt]
frame #12: 0x000a4120 mono`main(argc=6, argv=0xbff5e944) + 1184 at main.c:177 [opt]
frame #13: 0x000a3c75 mono`start + 53
Got a SIGABRT while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.
I am using Akka.Net in a very simple client server configuration. Nothing very advanced at this time. After about 3 or 4 days of sending messages back and forth it seems that the entire system gets in a disconnection state. With a restart of the services everything reconnects and there are no issues. Prior to this things will disconnect however it seems to reconnect right away.
During this time both machines are accessible on the network and don't seem to have any actual connection problems.
I am not sure where to go from here.
Client config (Server very similar)
return ConfigurationFactory
.ParseString(string.Format(#"
akka {{
loggers = [""XYZ.AkkaLogger, XYZ""]
actor {{
provider = ""Akka.Remote.RemoteActorRefProvider, Akka.Remote""
serializers {{
json = ""XYZ.AkkaSerializer, XYZ""
}}
}}
remote {{
helios.tcp {{
transport-class = ""Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote""
applied-adapters = []
transport-protocol = tcp
port = 0
hostname = {0}
send-buffer-size = 512000b
receive-buffer-size = 512000b
maximum-frame-size = 1024000b
tcp-keepalive = on
}}
transport-failure-detector {{
heartbeat-interval = 60 s # default 4s
acceptable-heartbeat-pause = 20 s # default 10s
}}
}}
stdout-loglevel = DEBUG
loglevel = DEBUG
debug {{
receive = on
autoreceive = on
lifecycle = on
event-stream = on
unhandled = on
}}
}}
", Environment.MachineName));
This cycle is pretty sporadic at first however after a while it repeats and nothing connects anymore until a reset of the service.
WARN 2015-07-31 07:22:12,994 [1584] - Association with remote system akka.tcp://SystemName#Server:8081 has failed; address is now gated for 5000 ms. Reason is: [Disassociated]
ERROR 2015-07-31 07:22:12,994 [1584] - Disassociated
Akka.Remote.EndpointDisassociatedException: Disassociated
at Akka.Remote.EndpointWriter.PublishAndThrow(Exception reason, LogLevel level)
at Akka.Remote.EndpointWriter.Unhandled(Object message)
at Akka.Remote.EndpointWriter.Writing(Object message)
at Akka.Actor.ActorCell.<>c__DisplayClass3e.<Akka.Actor.IUntypedActorContext.Become>b__3d(Object m)
at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message)
at Akka.Actor.ActorCell.ReceiveMessage(Object message)
at Akka.Actor.ActorCell.AutoReceiveMessage(Envelope envelope)
at Akka.Actor.ActorCell.Invoke(Envelope envelope)
DEBUG 2015-07-31 07:22:12,996 [1494] - Disassociated [akka.tcp://SystemName#Client:57284] -> akka.tcp://SystemName#Server:8081
DEBUG 2015-07-31 07:23:13,033 [1469] - Drained buffer with maxWriteCount: 50, fullBackoffCount: 1,smallBackoffCount: 0, noBackoffCount: 0,adaptiveBackoff: 10000
ERROR 2015-07-31 07:24:13,019 [1601] - No response from remote. Handshake timed out or transport failure detector triggered.
DEBUG 2015-07-31 07:24:13,020 [1569] - Disassociated [akka.tcp://SystemName#Client:57284] -> akka.tcp://SystemName#Server:8081
WARN 2015-07-31 07:24:13,020 [1601] - Association with remote system akka.tcp://SystemName#Server:8081 has failed; address is now gated for 5000 ms. Reason is: [Disassociated]
ERROR 2015-07-31 07:24:13,021 [1601] - Disassociated