Bug 58567 - C# + Mono (4.2.1) + Ubuntu (16.04) = Objects becoming null
Summary: C# + Mono (4.2.1) + Ubuntu (16.04) = Objects becoming null
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: 4.2.1 (C6SR0)
Hardware: Other Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-08-03 11:22 UTC by Gilad Rave
Modified: 2017-08-03 11:22 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Gilad Rave 2017-08-03 11:22:53 UTC
DISCLAIMER: Unfortunately, I cannot provide a simple test case of the issue, or a guaranteed way to reproduce.
D#2: Wasn't sure about which component to select for this bug.

So I have a C# application (single process with a few threads), which I'm running with Mono on a Linux VM (Azure/AWS).

Every once in a while some variable which couldn't possibly be null causes some null value exception. Examples:

* "Value cannot be null. Parameter name: source" on `var lst = JObject["list"].Select(x => x["key"].ToString());`

* "Specified cast is not valid." on the `Regex.Replace(Regex.Replace(txt, @"[^a-z ]", "", RegexOptions.IgnoreCase).ToLower(), @"  +", " ").Trim();`


This happens in various other places in the application.


Additionally, certain threads communicate via the disk, where one thread writes a Json to a file, and another thread reads it (the Json processing is done with the Newtonsoft package). And sometimes the Json received is invalid, and looks something like:

   { ... valid Json ... } extra characters which seem to be taken from an earlier message making the json invalid }


The above behavior leads me to believe that some sort of memory corruption is taking place. I cannot explain why or how it occurs, and certainly not how to prevent it.


Two things to note:

* The application never runs into these problems when executed on my Windows laptop.

* The Linux VM has relatively low memory (~0.7 GB RAM), but the app usually takes only about a third/half of that.

Note You need to log in before you can comment on or make changes to this bug.