Bug 32332 - Segmentation fault when calling NamedPipeServerStream.Disconnect()
Summary: Segmentation fault when calling NamedPipeServerStream.Disconnect()
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-07-22 16:04 UTC by jacques
Modified: 2017-08-28 15:02 UTC (History)
2 users (show)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 32332 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description jacques 2015-07-22 16:04:38 UTC
Getting the following on Fedora 22 with mono

Using the dmcs compiler.

When disconnecting a namedpipe connection I  get a segfault.

Running code like the following:

NamedPipeServerStream pipeClientConnection = new NamedPipeServerStream(pipeName, PipeDirection.In);
_inputStream = new StreamReader(pipeClientConnection);
_pipeServer = new Task(() =>
    while (true)
        Console.WriteLine("Report from pipe: " + _inputStream.ReadLine());
        pipeClientConnection.Disconnect(); // Commenting this line out fixes the problem

This opens the unix socket fine, but when I echo some text into the socket I get:

Opening Pipe
Opened, any key to exit
Report from pipe: kaythanksbye

Native stacktrace:

	mono() [0x49e695]
	mono() [0x4f09bb]
	mono() [0x421fdd]
	/lib64/libpthread.so.0(+0x10430) [0x7fa88e685430]
	/lib64/libc.so.6(fclose+0x4) [0x7fa88e10b754]

Debug info from gdb:

Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.

If I remove the Disconnect() line (marked as a comment), I no longer get a crash.