# File lib/phusion_passenger/utils/unseekable_socket.rb, line 48
        def wrap(socket)
                # Some people report that sometimes their Ruby (MRI/REE)
                # processes get stuck with 100% CPU usage. Upon further
                # inspection with strace, it turns out that these Ruby
                # processes are continuously calling lseek() on a socket,
                # which of course returns ESPIPE as error. gdb reveals
                # lseek() is called by fwrite(), which in turn is called
                # by rb_fwrite(). The affected socket is the
                # AbstractRequestHandler client socket.
                #
                # I inspected the MRI source code and didn't find
                # anything that would explain this behavior. This makes
                # me think that it's a glibc bug, but that's very
                # unlikely.
                #
                # The rb_fwrite() implementation takes an entirely
                # different code path if I set 'sync' to true: it will
                # skip fwrite() and use write() instead. So here we set
                # 'sync' to true in the hope that this will work around
                # the problem.
                socket.sync = true
                
                # There's no need to set the encoding for Ruby 1.9 because
                # abstract_request_handler.rb is tagged with 'encoding: binary'.
                
                @socket = socket
                
                return self
        end