Commit graph

5366 commits

Author SHA1 Message Date
Michael Meeks
5cafa006dc Wakeup poll after queueing a new session. 2017-03-10 23:28:54 +00:00
Michael Meeks
5763d8d9bb Improve debugging. 2017-03-10 23:28:34 +00:00
Michael Meeks
a9d5801c37 Unwind releaseSocket complexity.
We only move sockets in response to input on the socket, which
must happen in the thread that we're processing that input on.
Ergo - no need for this complexity.
2017-03-10 18:46:31 +00:00
Michael Meeks
027b8110ed Allow isCorrectThread asserts to be hard, or off by default. 2017-03-10 18:46:16 +00:00
Michael Meeks
c30fb670d8 Work on LOOL_CHECK_THREADS=1 a little.
The situation made more problematic since the std::thread is only
created in startThread - so getting ownership right before then in
Socket is problematic.
2017-03-10 18:20:51 +00:00
Michael Meeks
160446fd23 Work on resurrecting dying DocumentBrokers if we can.
The hope is that they will close lingering session sockets at the
end and the client will re-connect.
2017-03-10 17:58:51 +00:00
Michael Meeks
1065441e7c Don't autosave if we're being stopped and happened to be overdue. 2017-03-10 16:42:59 +00:00
Michael Meeks
173ca5e3d6 Quote ETag. 2017-03-10 16:42:48 +00:00
Michael Meeks
3b370022c0 Improve state dumping. 2017-03-10 15:37:09 +00:00
Michael Meeks
7a90430f85 Cleanup logging on single packet websocket messages more cleanly. 2017-03-10 14:49:19 +00:00
Michael Meeks
11f3a29cb2 WebSocket - several messages can appear in a single packet. 2017-03-10 14:36:21 +00:00
Michael Meeks
34d9d52207 Avoid assert failure and zero size socket buffer in product build. 2017-03-10 12:12:10 +00:00
Pranav Kant
eb9c0fa619 Do not create tags file for loleaflet
Change-Id: I0a2103bc4550d6deacddd1bfc07a23a3cf317d07
2017-03-10 17:29:44 +05:30
Michael Meeks
f4f083e6fe Cache JS etc. on the client side for 128 days. 2017-03-10 11:36:10 +00:00
Pranav Kant
ffd00d8824 loleaflet: Allow keeping document always active via PostMessage
To instruct the loleaflet iframe to not dim the document, it needs to
send the message in following format :

{
 MessageId: 'Set_Settings',
 SendTime: 1329014075000,
 Values: {
	AlwaysActive: true
 }
}

Similarly, set AlwaysActive to false to active dimming the screen again.

Change-Id: Icb5d615268e4da2c3ed2f22df8c0f3e52f370a70
2017-03-10 16:37:34 +05:30
Michael Meeks
a5a227e9a3 Re-work socket buffer options, sizing and setting.
Only set nodelay and small socket buffers on WebSockets.
Avoid writing more data than can be absorbed by our socket buffer.
It is fine to set socket buffer sizes after bind/accept.
2017-03-10 10:55:29 +00:00
Miklos Vajna
2f07eb9a7d Fix remaining -Werror,-Winconsistent-missing-override warnings
The last ones introduced by the non-blocking merge.

Change-Id: I0b9264428669cdd2b8f6eac911c336c6b0e8de99
2017-03-10 11:11:58 +01:00
Miklos Vajna
400c580800 net: fix -Werror,-Wconstant-conversion
Change-Id: If2bbad6d3909c7d6df9eed5edf260609d64db3a8
2017-03-10 11:06:43 +01:00
Miklos Vajna
33cbe908c5 net: fix -Werror,-Winconsistent-missing-override
Change-Id: Ia8c1f0233e0b65f5fae01272b4f31638aceac9ee
2017-03-10 10:54:08 +01:00
Miklos Vajna
2e2381b5b3 wsd: fix -Werror,-Winconsistent-missing-override
Change-Id: I0f009aea715e93c90683f333c96a04088d103964
2017-03-10 10:53:40 +01:00
Jan Holesovsky
4ba2325c81 Move Replay.hpp to headers.
Change-Id: Id65e81ce2b8a9b77d910524a00d9f42164365ab2
2017-03-10 10:47:44 +01:00
Ashod Nakashian
5677eb30b7 nb: fix saving when last client disconnects
When the last client session is disconnected
docBroker must first issue a save and wait
until the kit processes the save and sends
back notfication. Since said notification
goes to the ChildSession (which is the last)
and said ChildSession is the one that signals
to docBroker to persist the doc to the Storage,
we need to keep all components alive and kicking
during this final saving.

As such, when the last session is to be removed
from docBroker, we instead issue an autosave and
continue everything as normal. When the save
notification even arrives and ChildSession signals
docBroker to persist the doc, we check if we were
destroying and in that even remove that last session
and stop the polling thread.

The docBroker instance itself will get cleaned up
in due time.

Change-Id: Ie84e784284e1ec12b0b201d6bf75170b31f66147
2017-03-10 10:47:44 +01:00
Ashod Nakashian
41eb052780 nb: really wait 20 seconds for last save
Change-Id: Ia30beb1e68c55b9987a9730e9acab11bd2871811
2017-03-10 10:47:44 +01:00
Ashod Nakashian
2d621f1a47 nb: logging
Change-Id: Ic3b724d5869f75234af2238b96a90c4745155b86
2017-03-10 10:47:44 +01:00
Ashod Nakashian
7a5cc9ce6f nb: correct forkit initialization sequence
This avoids extra kits, avoid logging
unnecessary errors and adds informative logging.

Change-Id: I7a4bb0b690f9787fc362d0b6aefcc722586eaed1
2017-03-10 10:47:44 +01:00
Ashod Nakashian
0bf6e28f54 nb: cleanup old comments and move MAX_CONNECTIONS assertion
Change-Id: I24f3f4321ccc62c26c433d4a709b41c894a0196d
2017-03-10 10:47:44 +01:00
Ashod Nakashian
1da9bc3d69 nb: set the polling thread name for better logging
Change-Id: Iccc4337827f00af08327a4430f3d40fa69ac71b2
2017-03-10 10:47:44 +01:00
Michael Meeks
3bfc8aa7f3 Use larger socket buffers for serving files to improve efficiency.
The combination of nodelay + minimum buffers is horrific for
file-serving; speedup is from 3.3s to 33ms to serve bundle.js.
2017-03-10 10:47:44 +01:00
Michael Meeks
42a19e66e3 Centralize idle poll time. 2017-03-10 10:47:44 +01:00
Michael Meeks
438630c68f Start DocBroker thread later - when we've added our 1st session. 2017-03-10 10:47:44 +01:00
Michael Meeks
33d1fa7cc0 Kill SenderThreadPool. 2017-03-10 10:47:44 +01:00
Michael Meeks
e16fc97c15 SocketPoll - better control starting our threads.
Extraordinary trace with a thread starting before the SocketPoll's
derived classes had started - ie. with wrong vtables etc.
2017-03-10 10:47:44 +01:00
Michael Meeks
842b261d9f Move auto-save of document into the DocumentBroker poll more convincingly. 2017-03-10 10:47:44 +01:00
Michael Meeks
c097925e51 Move Kit / prisoner re-balancing into the PrisonerPoll thread. 2017-03-10 10:47:44 +01:00
Jan Holesovsky
4eccd4d7b4 nb: Check threads only when LOOL_CHECK_THREADS is set.
Change-Id: I4137685eb956469d419bded318b83de2b10ce19d
2017-03-10 10:47:44 +01:00
Jan Holesovsky
b895393cea nb: Perform the socket shutdown asynchronously after the data is served.
Change-Id: I642e26abf4ef9c8d2be1be428b5786692dfea2c7
2017-03-10 10:47:44 +01:00
Ashod Nakashian
b8af470918 nb: serve files synchronously
As there isn't support (yet) to send files
asynchronously, when the socket native buffer
is small, asynchronous writes naturally return
EWOULDBLOCK. As a temp solution, we send files
synchronously, so there is no need to poll.

This should be replaced witha file-server
polling/serving thread that is dedicated to
sending files only (which closes the connection
when done).

Change-Id: I062fea44bfe54ab8d147b745da97bd499bf00657
2017-03-10 10:47:44 +01:00
Michael Meeks
37de43bb58 Tie sockets to threads, and assert that we're being used in the right one.
This shows up some problems around cleaning up prisoners etc. that will
need fixing subsequently.
2017-03-10 10:47:43 +01:00
Michael Meeks
0eaef6c896 config.h - get includes right: must always be the first include. 2017-03-10 10:47:43 +01:00
Jan Holesovsky
c4c8d93bba nb: Blind attempt to fix running inside docker.
If nothing, it will at least improve the logging.

Change-Id: I35a8eb620a210aea9cf55c0eb47bda7b0d777cf8
2017-03-10 10:47:43 +01:00
Jan Holesovsky
59c5eeec4c Fix build.
Change-Id: I218895b6ba314250f0009fa465499f38953b49d8
2017-03-10 10:47:43 +01:00
Michael Meeks
d807db08f2 More descriptive comment. 2017-03-10 10:47:43 +01:00
Ashod Nakashian
ec3e795813 nb: remove superfluous assertion
Change-Id: I22e0e031768e52f83b6e0f062df61aaf6e881279
2017-03-10 10:47:43 +01:00
Ashod Nakashian
826217b4d8 nb: move the child socket to DocBroker poll
Change-Id: I8cbec60e49ca508df0e96e7e594f9dad15f84276
2017-03-10 10:47:43 +01:00
Ashod Nakashian
9f90722673 nb: contain exceptions when adding new session and loading
Change-Id: I35e6714e87eaf2c65d36bbf813ac1fd286a0fbb7
2017-03-10 10:47:43 +01:00
Ashod Nakashian
7b1ed1b4d4 nb: more informative logging of socket activity
Change-Id: I9036c778c195936678c6451ba57cc794d6ba0006
2017-03-10 10:47:43 +01:00
Ashod Nakashian
221bfdefc8 nb: get the poll sockets size after setting up
Change-Id: I35174f2f9345286791ccefe2d6dc521a767b6571
2017-03-10 10:47:43 +01:00
Ashod Nakashian
d6aa3324d5 nb: childProcess might not exist yet when terminating
Change-Id: I28b84233ea47ca0d8e3be33ba73d1165f37adb40
2017-03-10 10:47:43 +01:00
Ashod Nakashian
0f1c5827ec nb: sockets may disconnect before loading
So startDestroy must not assume the session
was already added at that point, since addSession
is done when we poll for reading, but not when
the socket has already disconnected.

Change-Id: I7bb7222604269c1cc9f2f4b4dad3ea1054b3e0c9
2017-03-10 10:47:43 +01:00
Ashod Nakashian
aee954af8b nb: include the SocketPoll name in logs
Change-Id: I7a93edfe0bc74e62bd2726f6fa8425c719326023
2017-03-10 10:47:43 +01:00