Process 0:0:0 (0x1ffc) Worker 0x00000001E580A1A0 appears to be non-yielding on Scheduler 3. Thread creation time: 13153975602106. Approx Thread CPU Used: kernel 0 ms, user 0 ms. Process Utilization 21%. System Idle 76%. Interval: 73616 ms.
Tanwar on October 1,
in Coding, Developers · 2
this part of the series, we will learn how to deal with multiple clients
connected to the server.
to another dose of socket programming! Till now, we’ve created servers
that are capable of creating connections with multiple clients [Part
1 & Part
but the problem is that the server will communicate with only one client
at any point in time. This is because there is only one socket
cfd, created to communicate with a client — and all
connections will wait on the same descriptor. Now, let’s use
fork() system call to fork a copy of the server for each
the code included from the previous article. This time it is for
am with the SQL Protocols Dev team. I’ve looked at the issue and most
likely it is related to the creation of child processes from within SQL
Server – e.g.
3rd party backup or compression software, etc. The problem occurs due to
a limitation of the Winsock API which does not offer creation of
socket handles. If a child process of SQL Server is created after a
connected socket is created and before the inheritance flag of the
see what we’ve done here. At line 23, after getting the socket
cfd from the call to accept, we forked the server. The
child process (where
pid==0) closes the listening descriptor
close(sfd), does the work the server is intended to do, and when
finished, closes the descriptor and returns (see lines 27-39).
is cleared, the child process inherits the socket handle. When closing
the corresponding client connection, a proper Tcp cleanup cannot be
the child process of SQL Server is closed.
server, on the other hand, where
pid>0, just closes the
39), and is again ready to accept more connections. Thus, for each
incoming connection, a new server process will be created.
implement a temporary workaround, add the TcpAbortiveClose SQL parameter
to registry as described in KB article
be careful if you are doing this on a cluster to avoid checkpoint issue
and registry misconfiguration which would prevent SQL from coming
Server needs to be restarted in order the changes to take effect. No
significant perf impact is expected from the change, no functional
impact should be either.
method of doing this is using threads, but we’re not getting into that
compile, run and see the server running and handling multiple clients.
See Figure 1 — I’m running the server on a network now (;) though these
clients are VirtualBox running VMs with Backtrack (192.168.1.19) and
Arch (192.168.1.4), and Android phone running ConnectBot to create a TCP