Go to file
Yonit Halperin 8490f83e1f decouple disconnection of the main channel from client destruction
Fixes rhbz#918169

Some channels make direct calls to reds/main_channel routines. If
these routines try to read/write to the socket, and they get socket
error, main_channel_client_on_disconnect is called, and triggers
red_client_destroy. In order to prevent accessing expired references
to RedClient, RedChannelClient, or other objects (inside the original call, after
red_client_destroy has been called) I made the call to
red_client_destroy asynchronous with respect to main_channel_client_on_disconnect.
I added MAIN_DISPATCHER_CLIENT_DISCONNECT to main_dispatcher.
main_channel_client_on_disconnect pushes this msg to the dispatcher,
instead of calling directly to reds_client_disconnect.

The patch uses RedClient ref-count in order to handle a case where
reds_client_disconnect is called directly (e.g., when a new client connects while
another one is connected), while there is already CLIENT_DISCONNECT msg
pending in the main_dispatcher.

Examples:
(1) snd_worker.c

    snd_disconnect_channel()
        channel->cleanup() //snd_playback_cleanup
            reds_enable_mm_timer()
                .
                .
                main_channel_push_multi_media_time()...socket_error
                    .
                    .
                    red_client_destory()
                        .
                        .
                        snd_disconnect_channel()
                            channel->cleanup()
                                celt051_encoder_destroy()
            celt051_encoder_destory() // double release

Note that this bug could have been solved by changing the order of
calls: e.g., channel->stream = NULL before calling cleanup, and
some other changes + reference counting. However, I found other
places in the code with similar problems, and I looked for a general
solution, at least till we redesign red_channel to handle reference
counting more consistently.

(2) inputs_channel.c

    inputs_connect()
        main_channel_client_push_notify()...socket_error
                .
                .
            red_client_destory()
                .
                .
        red_channel_client_create() // refers to client which is already destroyed

(3) reds.c

    reds_handle_main_link()
       main_channel_push_init() ...socket error
                .
                .
            red_client_destory()
                .
                .
       main_channel_client_start_net_test(mcc) // refers to mcc which is already destroyed

    This can explain the assert in rhbz#964136, comment #1 (but not the hang that occurred before).
2013-07-29 11:35:17 -04:00
build-aux add git-version-gen and gitlog-to-changelog 2012-10-19 14:15:06 +02:00
client spice-client: Add --hotkeys cmdline option 2012-12-19 15:07:09 +01:00
docs docs/Spice_for_newbies.odt: some updates - added copy paste and wan mention, removed vdi_port 2012-01-22 15:13:32 +02:00
m4 m4/spice-compile-warnings: Squelch _FORTIFY_SOURCE when needed to avoid glibc #warnings. 2012-06-06 17:32:02 +03:00
server decouple disconnection of the main channel from client destruction 2013-07-29 11:35:17 -04:00
spice-common@fe93908238 Update spice-common submodule (get spice-protocol 0.12.6) 2013-07-17 01:59:32 +03:00
tests tests/migrate.py: add --vdagent 2011-08-23 17:01:14 +03:00
tools Add casts for compatibility purposes 2012-02-14 10:44:49 +02:00
uncrustify_cfg fresh start 2009-10-14 15:06:41 +02:00
.gitignore add git-version-gen and gitlog-to-changelog 2012-10-19 14:15:06 +02:00
.gitmodules Use the spice-common submodule 2012-03-25 18:59:10 +02:00
.mailmap Add recent new committers to AUTHORS file / mailmap 2012-04-25 09:49:29 +01:00
AUTHORS syntax-check: update AUTHORS 2013-07-16 23:37:28 +03:00
autogen.sh Use the spice-common submodule 2012-03-25 18:59:10 +02:00
cfg.mk Add a few more syntax-check exemptions 2012-04-25 09:49:32 +01:00
ChangeLog fresh start 2009-10-14 15:06:41 +02:00
configure.ac TIOCOUTQ -> SIOCOUTQ and portability ifdefs 2013-07-22 12:01:59 -04:00
COPYING Relicense everything from GPL to LGPL 2.1+ 2010-04-13 22:22:15 +02:00
GITVERSION Add --enable-werror and make it the default only for git builds 2010-07-09 12:14:32 +02:00
GNUmakefile Add a 'syntax-check' make target 2012-01-13 18:12:00 +02:00
maint.mk syntax-check: trailing whitespaces -- ignore binary files 2013-07-17 01:59:32 +03:00
Makefile.am add git-version-gen and gitlog-to-changelog 2012-10-19 14:15:06 +02:00
NEWS Release 0.12.4 2013-07-17 18:32:58 +03:00
README README: make a note of SPICE_DEBUG_ALLOW_MC 2012-02-15 14:32:11 +02:00
spice-server.pc.in spice-server.pc.in: move Requires to Requires.private 2011-10-23 11:26:30 +02:00
TODO.multiclient Remove trailing whitespace from end of lines 2012-01-13 18:11:59 +02:00

   SPICE: Simple Protocol for Independent Computing Environments
   =============================================================

SPICE is a remote display system built for virtual environments which
allows you to view a computing 'desktop' environment not only on the
machine where it is running, but from anywhere on the Internet and
from a wide variety of machine architectures.

Installation
------------

The SPICE package uses GNU autotools, so the build install process
follows the standard process documented in the INSTALL file. As a
quick start you can do

  ./configure --prefix=/usr --sysconfdir=/etc \
        --localstatedir=/var --libdir=/usr/lib
  make
  sudo make install

Or to install into a private user specific location

  ./configure --prefix=$HOME/spice
  make
  make install

The following mandatory dependancies are required in order to
build SPICE

    Spice protocol >= 0.9.0
    Celt           >= 0.5.1.1, < 0.6.0
    Pixman         >= 0.17.7
    OpenSSL
    libjpeg
    zlib
    Cyrus-SASL

The following optional dependancies increase the available
functionality

    GE Gui         >= 0.6.0,  < 0.7.0   (GUI app support)
    OpenGL                              (GUI app support)
    Alsa                                (Linux support)
    XRandR         >= 1.2               (X11 support)
    Xinerama       >= 1.0               (X11 support)
    libcacard      >= 0.1.2             (Smartcard support)
    Slirp                               (Tunnelling support)

Communication
-------------

To communicate with the development team, or to post patches
there is a technical mailing list:

   http://lists.freedesktop.org/mailman/listinfo/spice-devel

There is also a mailing list for new release announcements:

   http://lists.freedesktop.org/archives/spice-announce/

To view known bugs, or report new bugs, in SPICE visit

   https://bugs.freedesktop.org/describecomponents.cgi?product=Spice

Bugs found when using an OS distribution's binary packages should
be reported to the OS vendors' own bug tracker first.

The latest SPICE code can be found in GIT at:

   http://cgit.freedesktop.org/spice/

Licensing
---------

SPICE is provided under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

Please see the COPYING file for the complete LGPLv2+ license
terms, or visit <http://www.gnu.org/licenses/>.

Experimental Features
---------------------
To enable multiple client connections, set:
SPICE_DEBUG_ALLOW_MC=1

-- End of readme