Bug 20245 - Socket.Disconnect throws exception "too many open files"
Summary: Socket.Disconnect throws exception "too many open files"
Status: CONFIRMED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: 3.4.0
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-06-01 04:06 UTC by Sergey Zhukov
Modified: 2017-09-06 17:06 UTC (History)
3 users (show)

Tags:
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 20245 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:
Status:
CONFIRMED

Description Sergey Zhukov 2014-06-01 04:06:33 UTC
If the user program does not properly disposes socket with Socket.Close, the exception "too many open files" can occur in Socket.Disconnect method, what is strange because this method does not allocate new socket.

TestCase: https://github.com/xplicit/HttpTestServer

run:
ab -c 30 -n 10000 http://localhost:9001/

Sometimes exception can occurs in Socket.EndAccept method, what is expected behaviour, but in most cases you'll catch it in Socket.Disconnect.

Information about test case. This testcase emulates web-server. For each opened connection it sends "Hello, world!" http response. All the thing is done in NetworkConnector.Disconnect method https://github.com/xplicit/HttpTestServer/blob/master/NetworkConnector.cs#L327
Comment 1 Sergey Zhukov 2014-06-01 05:04:51 UTC
mono --version
Mono JIT compiler version 3.4.1 (master/5ed69a0 Wed May 28 06:31:59 NOVT 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen
Comment 2 Martin Baulig 2016-11-11 09:46:44 UTC
Closing ancient bugs, please reopen if you're still having this problem.
Comment 3 Sergey Zhukov 2016-11-11 10:29:17 UTC
The problem still exists it's easily reproduced with test-case is mentioned above and mono 4.6.1

Mono JIT compiler version 4.6.1 (Stable 4.6.1.5/ef43c15 Wed Oct 12 09:10:37 UTC 2016)
OS: Ubuntu 16.04