Click here to Skip to main content
15,889,200 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there,
I have had a console program that does data analysis on a ~2GB file and I was wondering if it would be possible to get some help on just doing a small part of that analysis. Namely, about 1000 rows down a text file there is a list of component files that make up the whole file... I just need their names.

As an example, I have the following code that works just fine to grab these rows:
C#
protected void filebtn_Click(object sender, EventArgs e)
        {
            try
            {
				if (fileupload.HasFile)
				{ 
						using (StreamReader reader = new StreamReader(fileupload.PostedFile.InputStream))
						{
						    String line;
						    while ((line = reader.ReadLine()) != null)
						    {
						        bamnames.Add(line);
						    }
						}

				}
				foreach (string name in bamnames)
				{
					compare1box.Items.Add(name);
					compare2box.Items.Add(name);
				}
            }
            catch (Exception ex)
            {
                alertbar.Visible = true;
				alertbar.Text = "<div class='grid-x'><div class='callout alert'><h5>Houston, we have a problem</h5><p>" + ex.Message + "</p></div>";
			}


Where the output is two listboxes that will eventually allow the user to select which of these distinct sets in the file they want to compare. Once I know that, that's when the more hardcore analysis starts, but I can probably run that separately - a lot of this is to have an actual front end for starting and visualizing the analysis.

The problem is that when I use the streamreader to parse the String line so that I can actually pull out the names, this is what I get after several moments:

System.Net.Sockets.SocketException
Operation on non-blocking socket would block

Description: HTTP 500.Error processing request.

Details: Non-web exception. Exception origin (name of application or object): System.

Exception stack trace:
  at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.Net.Sockets.SocketFlags socketFlags) [0x00010] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/referencesource/System/net/System/Net/Sockets/Socket.cs:1771 
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x0009b] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/referencesource/System/net/System/Net/Sockets/NetworkStream.cs:513 
Version Information: 5.2.0.215 (d15-3/da80840 Thu Jul 20 16:43:07 EDT 2017); ASP.NET Version: 4.0.30319.42000


I have a try/catch, however, it's not catching whatever the issue is and I'm just on an Error 500 page.

This is in Mono. IIS is not available for me as I'm not on Windows right now.

What I have tried:

I've tried expanding the web.config as such:
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5">
      <assemblies />
    </compilation>
    <httpRuntime targetFramework="4.5" maxRequestLength="3145728" />
  </system.web>
</configuration>


I've attempted to run as a queued background task (but that's apparently just an MVC thing).

And I've tried to HttpPostedFile.InputStream the equivalent but somehow my string list of the names became 0's on the short test version and still gave the same 500 error on the large file.

I am open to a method that would run the analysis in just back-end, regular old cs files, but the point is to do this all in one visual studio solution so I'm not sure how that would work beyond scheduling tasks.

All constructive input appreciated.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900