pellenilsson / isso

a Disqus alternative
http://posativ.org/isso/
MIT License
20 stars 4 forks source link

UNABLE TO SAVE AUTHENTICATED POSTS - UNANONYMOUS POST ARE SAVED IN THE SQLITE DATABASE #16

Open papashilingi opened 5 years ago

papashilingi commented 5 years ago

Team,

Find below a log of my setup and logs of the virtual python environment, anonymous posts are accessible on the client interface as well as the SQLITE database. Challenge lies with AUTH messages, one can successfully AUTH via Gmail and successful logs captured on the logs but nothing appears in the database.

NB: Admin panel for moderation of posts appears not to work on isso-social any hints.

CLIENT SIDE CONFIGURATION

<script data-isso="https://bunge.MYDOMAIN.com/" css="true" src="https://bunge.MYDOMAIN.com/js/embed.min.js" async crossorigin="anonymous">

(vbunge) [root@VPS vbunge]# pip freeze asn1crypto==0.24.0 cffi==1.12.3 cryptography==2.7 ecdsa==0.13.2 future==0.17.1 html5lib==0.9999999 isso-social==0.10.7.5 itsdangerous==1.1.0 misaka==1.0.2 pyasn1==0.4.5 pycparser==2.19 python-jose==3.0.1 rsa==4.0 six==1.12.0 uWSGI==2.0.18 Werkzeug==0.15.5 (vbunge) [root@VPS vbunge]#

PYTHON VIRTUAL ENVIROMENT STARTUP LOGS

Starting uWSGI 2.0.18 (64bit) on [Tue Jul 30 15:40:30 2019] compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-36) on 23 July 2019 13:41:20 os: Linux-5.1.11-x86_64-XYZXYZ #1 SMP PREEMPT Mon Jun 17 21:18:26 UTC 2019 nodename: VPS.MYDOMAIN.com machine: x86_64 clock source: unix pcre jit disabled detected number of CPU cores: 1 current working directory: / detected binary path: /opt/django/vbunge/vbunge/bin/uwsgi chdir() to /opt/django/vbunge your processes number limit is 3843 your memory page size is 4096 bytes detected max file descriptor number: 1024 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) Cache "hash" initialized: 2MB (key: 2136 bytes, keys: 2187264 bytes, data: 32768 bytes, bitmap: 0 bytes) preallocated uwsgi socket 0 bound to UNIX address /run/uwsgi/vbunge.sock fd 4 setuid() to 997 Python version: 3.6.3 (default, Mar 20 2018, 13:50:41) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] Set PythonHome to /opt/django/vbunge/vbunge Python threads support is disabled. You can enable it with --enable-threads Python main interpreter initialized at 0x1143900 your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 60 seconds mapped 218760 bytes (213 KB) for 2 cores Operational MODE: preforking 2019-07-30 15:40:30,854 INFO: connected to SMTP server 2019-07-30 15:40:30,920 INFO: connected to https://MYDOMAIN.com/ WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x1143900 pid: 11831 (default app) uWSGI is running in multiple interpreter mode spawned uWSGI master process (pid: 11831) spawned the uWSGI spooler on dir /opt/django/vbunge/data/spool with pid 11835 spawned uWSGI worker 1 (pid: 11836, cores: 1) spawned uWSGI worker 2 (pid: 11837, cores: 1) cache sweeper thread enabled

CLIENT SIDE CONFIGURATION

<script data-isso="https://bunge.MYDOMAIN.com/" css="true" src="https://bunge.MYDOMAIN.com/js/embed.min.js" async crossorigin="anonymous">

NON AUTH POST GOES THROUGH SUCCESSFULLY [pid: 11836|app: 0|req: 2/5] 41.80.85.86 () {48 vars in 786 bytes} [Tue Jul 30 15:44:57 2019] OPTIONS /new?uri=%2enerated 0 bytes in 0 msecs (HTTP/2.0 200) 6 headers in 323 bytes (0 switches on core 0) 2019-07-30 15:44:57,668 ERROR: POST /new Traceback (most recent call last): File "/opt/django/vbunge/vbunge/lib/python3.6/site-packages/isso/init.py", line 137, in dispatch response = handler(request.environ, request, values) File "/opt/django/vbunge/vbunge/lib/python3.6/site-packages/isso/views/comments.py", line 79, in dec return func(self, env, req, *args, *kwargs) File "/opt/django/vbunge/vbunge/lib/python3.6/site-packages/isso/views/init.py", line 45, in dec return func(cls, env, req, args, kwargs) File "/opt/django/vbunge/vbunge/lib/python3.6/site-packages/isso/views/comments.py", line 363, in new self.signal("comments.new:after-save", thread, rv) File "/opt/django/vbunge/vbunge/lib/python3.6/site-packages/isso/ext/init.py", line 17, in call subscriber(*args, **kwargs) File "/opt/django/vbunge/vbunge/lib/python3.6/site-packages/isso/ext/notifications.py", line 127, in notify uwsgi.spool({b"subject": thread["title"].encode("utf-8"), AttributeError: 'NoneType' object has no attribute 'encode' [pid: 11836|app: 0|req: 3/6] 41.80.85.86 () {50 vars in 1202 bytes} [Tue Jul 30 15:44:57 2019] POST /new?uri=%2Fberated 290 bytes in 12 msecs (HTTP/2.0 500) 7 headers in 362 bytes (1 switches on core 0)

(vbunge) [root@VPS data]# sqlite3 comments.db SQLite version 3.7.17 2013-05-20 00:56:22 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> select * from comments; 1|1||1564501497.6653||1|abc.abc.abc.abc|Test non AUTH POST|Andreson Kazungu|info@aeronet.co.ke||0|0|||| sqlite>

AUTH VIA GOOGLE API SUCCESSFUL BUT COMMENT NOT SAVED IN THE SQLITE DATABASE

[pid: 11836|app: 0|req: 3/6] 41.80.85.86 () {50 vars in 1202 bytes} [Tue Jul 30 15:44:57 2019] POST /new?uri=%2erated 290 bytes in 12 msecs (HTTP/2.0 500) 7 headers in 362 bytes (1 switches on core 0) [pid: 11837|app: 0|req: 4/7] 41.80.85.86 () {48 vars in 786 bytes} [Tue Jul 30 15:48:52 2019] OPTIONS /new?uri=%2Fblog%2F => generated 0 bytes in 0 msecs (HTTP/2.0 200) 6 headers in 323 bytes (0 switches on core 0) [pid: 11836|app: 0|req: 4/8] 41.80.85.86 () {50 vars in 1176 bytes} [Tue Jul 30 15:48:52 2019] POST /new?uri=%2Fblog%2F => generated 149 bytes in 150 msecs (HTTP/2.0 400) 7 headers in 352 bytes (1 switches on core 0) [pid: 11837|app: 0|req: 5/9] 41.80.85.86 () {48 vars in 786 bytes} [Tue Jul 30 15:49:12 2019] OPTIONS /new?uri=%2Fblog%2F => generated 0 bytes in 0 msecs (HTTP/2.0 200) 6 headers in 323 bytes (0 switches on core 0) [pid: 11836|app: 0|req: 5/10] 41.80.85.86 () {50 vars in 1176 bytes} [Tue Jul 30 15:49:12 2019] POST /new?uri=%2Fblog%2F => generated 149 bytes in 13 msecs (HTTP/2.0 400) 7 headers in 352 bytes (1 switches on core 0) [pid: 11837|app: 0|req: 6/11] 41.80.85.86 () {48 vars in 761 bytes} [Tue Jul 30 15:51:08 2019] OPTIONS /count=> generated 0 bytes in 0 msecs (HTTP/2.0 200) 6 headers in 323 bytes (0 switches on core 0) [pid: 11836|app: 0|req: 6/12] 41.80.85.86 () {48 vars in 779 bytes} [Tue Jul 30 15:51:08 2019] OPTIONS /?uri=%2Fblog%2F => generated 0 bytes in 1 msecs (HTTP/2.0 200) 6 headers in 323 bytes (0 switches on core 0) [pid: 11837|app: 0|req: 7/13] 41.80.85.86 () {50 vars in 1145 bytes} [Tue Jul 30 15:51:08 2019] POST /count => generated 2 bytes in 10 msecs (HTTP/2.0 200) 7 headers in 348 bytes (1 switches on core 0) [pid: 11836|app: 0|req: 7/14] 41.80.85.86 () {48 vars in 1138 bytes} [Tue Jul 30 15:51:08 2019] GET /?uri=%2Fblog%2F => generated 1032 bytes in 37 msecs (HTTP/2.0 200) 7 headers in 351 bytes (1 switches on core 0) [pid: 11837|app: 0|req: 8/15] 41.80.85.86 () {48 vars in 761 bytes} [Tue Jul 30 15:51:13 2019] OPTIONS /count=> generated 0 bytes in 0 msecs (HTTP/2.0 200) 6 headers in 323 bytes (0 switches on core 0) [pid: 11837|app: 0|req: 9/16] 41.80.85.86 () {48 vars in 779 bytes} [Tue Jul 30 15:51:13 2019] OPTIONS /?uri=%2Fblog%2F => generated 0 bytes in 0 msecs (HTTP/2.0 200) 6 headers in 323 bytes (0 switches on core 0) [pid: 11837|app: 0|req: 10/17] 41.80.85.86 () {50 vars in 1173 bytes} [Tue Jul 30 15:51:14 2019] POST /count => generated 2 bytes in 2 msecs (HTTP/2.0 200) 7 headers in 348 bytes (1 switches on core 0) [pid: 11837|app: 0|req: 11/18] 41.80.85.86 () {48 vars in 1166 bytes} [Tue Jul 30 15:51:14 2019] GET /?uri=%2Fblog%2F => generated 1032 bytes in 37 msecs (HTTP/2.0 200) 7 headers in 351 bytes (1 switches on core 0) )

pellenilsson commented 5 years ago

I cannot reproduce the AttributeError from your log with either python 2.7.9 or 3.4.2, but I think the problem comes from the usage of io.StringIO for string formatting in the format method in the same file. There are reports that it can cause problems because it is non-blocking, so the data might not be ready yet during the read() call. I have replaced it with more standard string formatting in an experimental branch python3-fixes. Can you try that branch, or do you need a release build?

Note also that I haven't tried supporting python 3 until now. The same branch python3-fixes also contains fixes for the first few issues that I bumbed into, but there is probably more. I will look more into python 3 support, but if you encounter more problems you may want to try with python 2.