Problems with python daemon

15 views
Skip to first unread message

Paul Stone

unread,
Oct 28, 2009, 5:35:55 AM10/28/09
to MobWrite
I'm having problems getting mobwrite working correctly as a python
daemon. The daemon runs fine, and the q.php script connects to it
fine. The demo webpage sends and receives data ok too. But nothing
ever gets synchronised properly. The demo page works fine if I point
it at the appspot app engine.

I have noticed some differences in the debug information when using
the appspot mobwrite vs the python daemon. It looks like the revisions
aren't being accepted. Here is the debug output for editor.html for
three empty 'syncs' when using the appspot engine:

TO server:
u:vls8ftxq
F:0:demo_editor_title_1
r:1:
F:0:demo_editor_text_1
r:1:

FROM server:
F:1:demo_editor_title_1
d:0:=0
F:1:demo_editor_text_1
d:0:=0

TO server:
u:vls8ftxq
F:1:demo_editor_title_1
d:1:=0
F:1:demo_editor_text_1
d:1:=0

FROM server:
F:2:demo_editor_title_1
d:1:=0
F:2:demo_editor_text_1
d:1:=0

TO server:
u:vls8ftxq
F:2:demo_editor_title_1
d:2:=0
F:2:demo_editor_text_1
d:2:=0

FROM server:
F:3:demo_editor_title_1
d:2:=0
F:3:demo_editor_text_1
d:2:=0
--------------------------
Here is the debug output when syncing to the python daemon:

TO server:
u:ryl7k9or
F:0:demo_editor_title_1
r:1:
F:0:demo_editor_text_1
r:1:

FROM server:
F:1:demo_editor_title_1
d:0:=0
F:1:demo_editor_text_1
d:0:=0

TO server:
u:ryl7k9or
F:0:demo_editor_title_1
r:1:
r:2:
F:0:demo_editor_text_1
r:1:
r:2:

FROM server:
F:2:demo_editor_title_1
d:0:=0
F:2:demo_editor_text_1
d:0:=0

TO server:
u:ryl7k9or
F:0:demo_editor_title_1
r:1:
r:2:
r:3:
F:0:demo_editor_text_1
r:1:
r:2:
r:3:

FROM server:
F:3:demo_editor_title_1
d:0:=0
F:3:demo_editor_text_1
d:0:=0

----------------
Here is the output from the python daemon for the same session:

INFO:mobwrite:Running cleanup task.
INFO:mobwrite:Listening on port 3017...
INFO:mobwrite:Connection accepted from 127.0.0.1
DEBUG:mobwrite:Creating text: 'demo_editor_title_1'
DEBUG:mobwrite:Creating view: 'ryl7k9or@demo_editor_title_1'
INFO:mobwrite:Got 0b raw text: 'ryl7k9or@demo_editor_title_1'
DEBUG:mobwrite:Overwrote content: 'ryl7k9or@demo_editor_title_1'
INFO:mobwrite:Sent '=0' delta: 'ryl7k9or@demo_editor_title_1'
DEBUG:mobwrite:Creating text: 'demo_editor_text_1'
DEBUG:mobwrite:Creating view: 'ryl7k9or@demo_editor_text_1'
INFO:mobwrite:Got 0b raw text: 'ryl7k9or@demo_editor_text_1'
DEBUG:mobwrite:Overwrote content: 'ryl7k9or@demo_editor_text_1'
INFO:mobwrite:Sent '=0' delta: 'ryl7k9or@demo_editor_text_1'
DEBUG:mobwrite:Disconnecting.
INFO:mobwrite:Connection accepted from 127.0.0.1
DEBUG:mobwrite:Accepting view: 'ryl7k9or@demo_editor_title_1'
WARNING:mobwrite:Rollback from shadow 1 to backup shadow 0
INFO:mobwrite:Got 0b raw text: 'ryl7k9or@demo_editor_title_1'
INFO:mobwrite:Got 0b raw text: 'ryl7k9or@demo_editor_title_1'
INFO:mobwrite:Sent '=0' delta: 'ryl7k9or@demo_editor_title_1'
DEBUG:mobwrite:Accepting view: 'ryl7k9or@demo_editor_text_1'
WARNING:mobwrite:Rollback from shadow 1 to backup shadow 0
INFO:mobwrite:Got 0b raw text: 'ryl7k9or@demo_editor_text_1'
INFO:mobwrite:Got 0b raw text: 'ryl7k9or@demo_editor_text_1'
INFO:mobwrite:Sent '=0' delta: 'ryl7k9or@demo_editor_text_1'
DEBUG:mobwrite:Disconnecting.
INFO:mobwrite:Connection accepted from 127.0.0.1
DEBUG:mobwrite:Accepting view: 'ryl7k9or@demo_editor_title_1'
WARNING:mobwrite:Rollback from shadow 1 to backup shadow 0
INFO:mobwrite:Got 0b raw text: 'ryl7k9or@demo_editor_title_1'
INFO:mobwrite:Got 0b raw text: 'ryl7k9or@demo_editor_title_1'
INFO:mobwrite:Got 0b raw text: 'ryl7k9or@demo_editor_title_1'
INFO:mobwrite:Sent '=0' delta: 'ryl7k9or@demo_editor_title_1'
DEBUG:mobwrite:Accepting view: 'ryl7k9or@demo_editor_text_1'
WARNING:mobwrite:Rollback from shadow 1 to backup shadow 0
INFO:mobwrite:Got 0b raw text: 'ryl7k9or@demo_editor_text_1'
INFO:mobwrite:Got 0b raw text: 'ryl7k9or@demo_editor_text_1'
INFO:mobwrite:Got 0b raw text: 'ryl7k9or@demo_editor_text_1'
INFO:mobwrite:Sent '=0' delta: 'ryl7k9or@demo_editor_text_1'
DEBUG:mobwrite:Disconnecting.

I'm using the latest released version of mobwrite
(mobwrite_daemon_20090825.zip), and default settings for both the
frontend and backend.

Paul Stone

unread,
Oct 28, 2009, 8:06:30 AM10/28/09
to MobWrite
Ok, so I figured out the problem. The data returned from the server
didn't have a trailing newline so the JavaScript client didn't parse
it correctly. If fixed it by changing the last line of q.php to: echo
"$in\n";

I notice that both q.py and q.jsp add trailing newlines to the output,
so I guess the PHP version just got missed out.

Neil Fraser

unread,
Oct 29, 2009, 1:39:55 PM10/29/09
to mobw...@googlegroups.com
2009/10/28 Paul Stone <ston...@gmail.com>:

Thank you for this. The q.* gateways are in a testing blindspot. I
don't have unit tests for these scripts since I don't have
environments configured for JSP, PHP, or the two modes of mod_python.
As a result these files are at risk of bit-rot. I try not to change
them too much. Your assistance is appreciated in keeping these alive.

--
Neil Fraser, Programmer & Wizard
http://neil.fraser.name

Reply all
Reply to author
Forward
0 new messages