Google cloud compute engine freeze - google-compute-engine

Today I found out that my vm instance in the google cloud had an issue.
I could not connect via gcloud compute ssh. The only solution was to shut the vm down and restart it.
I guess I found the right log file where the error happened.
/var/log/daemon.log
Nov 23 17:39:01 globo-de systemd[1]: Started Clean php session files.
Nov 23 18:09:01 globo-de systemd[1]: Starting Clean php session files...
Nov 23 18:09:03 globo-de systemd[1]: Started Clean php session files.
Nov 23 18:39:01 globo-de systemd[1]: Starting Clean php session files...
Nov 23 18:39:04 globo-de systemd[1]: Started Clean php session files.
Nov 23 18:56:49 globo-de google-ip-forwarding: WARNING Exception running ['ip', 'route', 'ls', 'table', 'local', 'type', 'local', 'scope', 'host', 'dev', 'eth0', 'proto', '66']. [Errno 12] Cannot allocate memory.
Nov 23 18:57:43 globo-de google-accounts: ERROR Exception calling the response handler. [Errno 12] Cannot allocate memory.#012Traceback (most recent call last):#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/metadata_watcher.py", line 196, in WatchMetadata#012 handler(response)#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/accounts_daemon.py", line 259, in HandleAccounts#012 self.oslogin.UpdateOsLogin(enable=False)#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/oslogin_utils.py", line 79, in UpdateOsLogin#012 status = self._GetStatus()#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/oslogin_utils.py", line 60, in _GetStatus#012 retcode = self._RunOsLoginControl('status')#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/oslogin_utils.py", line 47, in _RunOsLoginControl#012 return subprocess.call([constants.OSLOGIN_CONTROL_SCRIPT, action])#012 File "/usr/lib/python2.7/subprocess.py", line 168, in call#012 return Popen(*popenargs, **kwargs).wait()#012 File "/usr/lib/python2.7/subprocess.py", line 390, in __init__#012 errread, errwrite)#012 File "/usr/lib/python2.7/subprocess.py", line 916, in _execute_child#012 self.pid = os.fork()#012OSError: [Errno 12] Cannot allocate memory
Nov 23 18:58:02 globo-de google-ip-forwarding: WARNING Exception running ['ip', 'route', 'ls', 'table', 'local', 'type', 'local', 'scope', 'host', 'dev', 'eth0', 'proto', '66']. [Errno 12] Cannot allocate memory.
Nov 23 18:59:35 globo-de google-ip-forwarding: WARNING Exception running ['ip', 'route', 'ls', 'table', 'local', 'type', 'local', 'scope', 'host', 'dev', 'eth0', 'proto', '66']. [Errno 12] Cannot allocate memory.
Nov 23 18:59:54 globo-de google-accounts: ERROR Exception calling the response handler. [Errno 12] Cannot allocate memory.#012Traceback (most recent call last):#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/metadata_watcher.py", line 196, in WatchMetadata#012 handler(response)#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/accounts_daemon.py", line 259, in HandleAccounts#012 self.oslogin.UpdateOsLogin(enable=False)#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/oslogin_utils.py", line 79, in UpdateOsLogin#012 status = self._GetStatus()#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/oslogin_utils.py", line 60, in _GetStatus#012 retcode = self._RunOsLoginControl('status')#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/oslogin_utils.py", line 47, in _RunOsLoginControl#012 return subprocess.call([constants.OSLOGIN_CONTROL_SCRIPT, action])#012 File "/usr/lib/python2.7/subprocess.py", line 168, in call#012 return Popen(*popenargs, **kwargs).wait()#012 File "/usr/lib/python2.7/subprocess.py", line 390, in __init__#012 errread, errwrite)#012 File "/usr/lib/python2.7/subprocess.py", line 916, in _execute_child#012 self.pid = os.fork()#012OSError: [Errno 12] Cannot allocate memory
Nov 23 19:03:53 globo-de google-ip-forwarding: WARNING Exception running ['ip', 'route', 'ls', 'table', 'local', 'type', 'local', 'scope', 'host', 'dev', 'eth0', 'proto', '66']. [Errno 12] Cannot allocate memory.
Nov 23 19:07:52 globo-de google-accounts: ERROR Exception calling the response handler. [Errno 12] Cannot allocate memory.#012Traceback (most recent call last):#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/metadata_watcher.py", line 196, in WatchMetadata#012 handler(response)#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/accounts_daemon.py", line 259, in HandleAccounts#012 self.oslogin.UpdateOsLogin(enable=False)#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/oslogin_utils.py", line 79, in UpdateOsLogin#012 status = self._GetStatus()#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/oslogin_utils.py", line 60, in _GetStatus#012 retcode = self._RunOsLoginControl('status')#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/oslogin_utils.py", line 47, in _RunOsLoginControl#012 return subprocess.call([constants.OSLOGIN_CONTROL_SCRIPT, action])#012 File "/usr/lib/python2.7/subprocess.py", line 168, in call#012 return Popen(*popenargs, **kwargs).wait()#012 File "/usr/lib/python2.7/subprocess.py", line 390, in __init__#012 errread, errwrite)#012 File "/usr/lib/python2.7/subprocess.py", line 916, in _execute_child#012 self.pid = os.fork()#012OSError: [Errno 12] Cannot allocate memory
Nov 23 19:09:37 globo-de google-ip-forwarding: WARNING Exception running ['ip', 'route', 'ls', 'table', 'local', 'type', 'local', 'scope', 'host', 'dev', 'eth0', 'proto', '66']. [Errno 12] Cannot allocate memory.
Nov 23 19:11:32 globo-de systemd[1]: phpsessionclean.service: Failed to fork: Cannot allocate memory
Nov 23 19:11:56 globo-de systemd[1]: phpsessionclean.service: Failed to run 'start' task: Cannot allocate memory
Nov 23 19:12:24 globo-de systemd[1]: Failed to start Clean php session files.
Nov 23 19:12:50 globo-de systemd[1]: phpsessionclean.service: Unit entered failed state.
Nov 23 19:13:37 globo-de systemd[1]: phpsessionclean.service: Failed with result 'resources'.
Nov 23 19:14:58 globo-de systemd[1]: apt-daily.service: Failed to fork: Cannot allocate memory
Nov 23 19:16:13 globo-de systemd[1]: apt-daily.service: Failed to run 'start' task: Cannot allocate memory
What can I do to prevent that from happening again?

I guess the problem was that the google-cloud-compute engine vm had no swap file. So I created one with the following commands I found on google.
sudo dd if=/dev/zero of=/var/swap bs=2048 count=524288
sudo chmod 600 /var/swap
sudo mkswap /var/swap
sudo swapon /var/swap
Then I added the following line to /etc/fstab to make it permanent.
/var/swap none swap sw 0 0

Another solution is to avoid swapping setting vm.swappiness to 0.
# sysctl -w vm.swappiness=0
However, it sounds me more like an OS image issue than google clouds.

Related

Chrome failed to start in GitHub Actions

This is the error message I get from GitHub workflows:
/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py:76: in __init__ 47 RemoteWebDriver.__init__( 48 /opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py:157: in __init__ 49 self.start_session(capabilities, browser_profile) 50 /opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py:252: in start_session 51 response = self.execute(Command.NEW_SESSION, parameters) 52 /opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute 53 self.error_handler.check_response(response)
response = {'status': 500, 'value': '{"value":{"error":"unknown error","message":"unknown error: Chrome failed to start: exited a...wn>\\n#14 0x563a8d1c9e58 \\u003Cunknown>\\n#15 0x563a8d1e3dfd \\u003Cunknown>\\n#16 0x7f9599f6f609 start_thread\\n"}}'}
Note: I am using webdriver manager to install chrome driver.

Django MySQL server has gone away

I have a django site the was using sqlite for the backend, recently we upgraded to MySQL and now are receiving intermittent errors:
'MySQL server has gone away'
After starting the site it loads fine, clicking around to change pages will result in the error usually after viewing 1 to 6 pages. The page it occurs on appears to be irrelevant, the same page may load fine the first time but throw the error the 2nd time.
Here's my environment:
Nginx running on host machine as reverse proxy
Docker container running Nginx inside, Django 1.8, uwsgi, and Python 3.4.
Django is using the mysqlclient db driver.
Google Cloud MySQL, 2nd generation
I've tried using a local MySQL server rather than the Google Cloud MySQL, it didn't make a difference. I also tried using the MySQL Connector/Python DB driver instead of mysqlclient. It produced a different (but similar) error message and traceback.
If I go back to SQLite, it works fine. Running under the django development server rather than nginx also works fine.
I've seen posts for this error stating that the django CONN_MAX_AGE should be less than the MySQL wait_timeout, but I'm using the default CONN_MAX_AGE setting of 0. According to the django docs, setting this to 0 (default) causes django to create a new database connection for each request. A value greater than 0 will define how long the connection remains open so it can be reused by another request. If I set it to a value greater than 0 the error goes away, but I'm concerned that I'm just deferring the error until later after the persistent connection expires. Also the django development web server creates a new connection for each request (similar to CONN_MAX_AGE=0), but I don't get the error using the dev server. Django versions prior to 1.6 did not support persistent connections, so it seems like I should be able to keep the default CONN_MAX_AGE=0 setting.
I had to enable logging for uwsgi, it's error log shows the following:
*** Starting uWSGI 2.0.13.1 (64bit) on [Fri Nov 18 22:15:33 2016] ***
compiled with version: 4.8.4 on 18 May 2016 17:48:05
os: Linux-4.4.0-45-generic #66-Ubuntu SMP Wed Oct 19 14:12:37 UTC 2016
nodename: 083c33814e43
machine: x86_64
clock source: unix
detected number of CPU cores: 8
current working directory: /
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /srv/ftc
your memory page size is 4096 bytes
detected max file descriptor number: 65536
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /srv/ftc/ftc.sock fd 3
Python version: 3.4.3 (default, Oct 14 2015, 20:31:36) [GCC 4.8.4]
Set PythonHome to /srv/env/ftc
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x22a73d0
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 1476189 bytes (1441 KB) for 10 cores
*** Operational MODE: preforking ***
Loading configuration from /srv/ftc/data/settings_local.py
WSGI app 0 (mountpoint='') ready in 2 seconds on interpreter 0x22a73d0 pid: 9 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 9)
spawned uWSGI worker 1 (pid: 17, cores: 1)
spawned uWSGI worker 2 (pid: 18, cores: 1)
spawned uWSGI worker 3 (pid: 19, cores: 1)
spawned uWSGI worker 4 (pid: 20, cores: 1)
spawned uWSGI worker 5 (pid: 21, cores: 1)
spawned uWSGI worker 6 (pid: 22, cores: 1)
spawned uWSGI worker 7 (pid: 23, cores: 1)
spawned uWSGI worker 8 (pid: 24, cores: 1)
spawned uWSGI worker 9 (pid: 25, cores: 1)
spawned uWSGI worker 10 (pid: 26, cores: 1)
[pid: 21|app: 0|req: 1/1] 192.168.1.15 () {38 vars in 637 bytes} [Fri Nov 18 17:15:39 2016] GET /faq/ => generated 13018 bytes in 3021 msecs (HTTP/1.1 200) 8 headers in 412 bytes (1 switches on core 0)
[pid: 21|app: 0|req: 2/2] 192.168.1.15 () {40 vars in 707 bytes} [Fri Nov 18 17:16:20 2016] GET /find-local-food/ => generated 20480 bytes in 1510 msecs (HTTP/1.1 200) 7 headers in 290 bytes (2 switches on core 0)
[pid: 21|app: 0|req: 3/3] 192.168.1.15 () {40 vars in 711 bytes} [Fri Nov 18 17:16:23 2016] GET /my-programs/ => generated 9297 bytes in 1454 msecs (HTTP/1.1 200) 7 headers in 290 bytes (2 switches on core 0)
[pid: 21|app: 0|req: 4/4] 192.168.1.15 () {40 vars in 683 bytes} [Fri Nov 18 17:16:26 2016] GET / => generated 13562 bytes in 3037 msecs (HTTP/1.1 200) 8 headers in 412 bytes (2 switches on core 0)
[pid: 21|app: 0|req: 5/5] 192.168.1.15 () {40 vars in 683 bytes} [Fri Nov 18 17:16:30 2016] GET /about/ => generated 10064 bytes in 1586 msecs (HTTP/1.1 200) 7 headers in 290 bytes (2 switches on core 0)
[pid: 21|app: 0|req: 6/6] 192.168.1.15 () {40 vars in 685 bytes} [Fri Nov 18 17:16:33 2016] GET /faq/ => generated 13018 bytes in 1145 msecs (HTTP/1.1 200) 8 headers in 412 bytes (2 switches on core 0)
[pid: 21|app: 0|req: 7/7] 192.168.1.15 () {40 vars in 691 bytes} [Fri Nov 18 17:16:35 2016] GET /contact/ => generated 8734 bytes in 1352 msecs (HTTP/1.1 200) 7 headers in 290 bytes (2 switches on core 0)
[pid: 21|app: 0|req: 8/8] 192.168.1.15 () {40 vars in 711 bytes} [Fri Nov 18 17:16:38 2016] GET /find-local-food/ => generated 20480 bytes in 1484 msecs (HTTP/1.1 200) 7 headers in 290 bytes (2 switches on core 0)
[pid: 21|app: 0|req: 9/9] 192.168.1.15 () {40 vars in 699 bytes} [Fri Nov 18 17:16:41 2016] GET /about/ => generated 10064 bytes in 1723 msecs (HTTP/1.1 200) 7 headers in 290 bytes (2 switches on core 0)
Traceback (most recent call last):
File "/srv/env/ftc/lib/python3.4/site-packages/django/core/urlresolvers.py", line 393, in urlconf_module
return self._urlconf_module
AttributeError: 'RegexURLResolver' object has no attribute '_urlconf_module'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/env/ftc/lib/python3.4/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/srv/env/ftc/lib/python3.4/site-packages/django/db/backends/mysql/base.py", line 124, in execute
return self.cursor.execute(query, args)
File "/srv/env/ftc/lib/python3.4/site-packages/MySQLdb/cursors.py", line 250, in execute
self.errorhandler(self, exc, value)
File "/srv/env/ftc/lib/python3.4/site-packages/MySQLdb/connections.py", line 42, in defaulterrorhandler
raise errorvalue
File "/srv/env/ftc/lib/python3.4/site-packages/MySQLdb/cursors.py", line 247, in execute
res = self._query(query)
File "/srv/env/ftc/lib/python3.4/site-packages/MySQLdb/cursors.py", line 411, in _query
rowcount = self._do_query(q)
File "/srv/env/ftc/lib/python3.4/site-packages/MySQLdb/cursors.py", line 374, in _do_query
db.query(q)
File "/srv/env/ftc/lib/python3.4/site-packages/MySQLdb/connections.py", line 270, in query
_mysql.connection.query(self, query)
_mysql_exceptions.OperationalError: (2006, 'MySQL server has gone away')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/srv/env/ftc/lib/python3.4/site-packages/django/core/handlers/wsgi.py", line 170, in __call__
self.load_middleware()
File "/srv/env/ftc/lib/python3.4/site-packages/django/core/handlers/base.py", line 52, in load_middleware
mw_instance = mw_class()
File "/srv/env/ftc/lib/python3.4/site-packages/django/middleware/locale.py", line 24, in __init__
for url_pattern in get_resolver(None).url_patterns:
File "/srv/env/ftc/lib/python3.4/site-packages/django/core/urlresolvers.py", line 401, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/srv/env/ftc/lib/python3.4/site-packages/django/core/urlresolvers.py", line 395, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/srv/env/ftc/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "./ftc/urls.py", line 23, in <module>
url(r'^', include('areas.public.urls')),
File "/srv/env/ftc/lib/python3.4/site-packages/django/conf/urls/__init__.py", line 33, in include
urlconf_module = import_module(urlconf_module)
File "/srv/env/ftc/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "./areas/public/urls.py", line 36, in <module>
url(r'^paypal/', include('areas.public.paypal.urls')),
File "/srv/env/ftc/lib/python3.4/site-packages/django/conf/urls/__init__.py", line 33, in include
urlconf_module = import_module(urlconf_module)
File "/srv/env/ftc/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "./areas/public/paypal/urls.py", line 5, in <module>
from . import payment_complete
File "./areas/public/paypal/payment_complete.py", line 9, in <module>
PublicCommon = PublicCommon()
File "./areas/public/common/__init__.py", line 34, in __init__
self.login_page = self.get_cms_page('pu_login')
File "./areas/public/common/__init__.py", line 27, in get_cms_page
return get_object_or_404(Page, reverse_id=reverse_id, publisher_is_draft=False)
File "/srv/env/ftc/lib/python3.4/site-packages/django/shortcuts.py", line 155, in get_object_or_404
return queryset.get(*args, **kwargs)
File "/srv/env/ftc/lib/python3.4/site-packages/django/db/models/query.py", line 328, in get
num = len(clone)
File "/srv/env/ftc/lib/python3.4/site-packages/django/db/models/query.py", line 144, in __len__
self._fetch_all()
File "/srv/env/ftc/lib/python3.4/site-packages/django/db/models/query.py", line 965, in _fetch_all
self._result_cache = list(self.iterator())
File "/srv/env/ftc/lib/python3.4/site-packages/django/db/models/query.py", line 238, in iterator
results = compiler.execute_sql()
File "/srv/env/ftc/lib/python3.4/site-packages/django/db/models/sql/compiler.py", line 840, in execute_sql
cursor.execute(sql, params)
File "/srv/env/ftc/lib/python3.4/site-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/srv/env/ftc/lib/python3.4/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/srv/env/ftc/lib/python3.4/site-packages/django/db/utils.py", line 98, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/srv/env/ftc/lib/python3.4/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/srv/env/ftc/lib/python3.4/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/srv/env/ftc/lib/python3.4/site-packages/django/db/backends/mysql/base.py", line 124, in execute
return self.cursor.execute(query, args)
File "/srv/env/ftc/lib/python3.4/site-packages/MySQLdb/cursors.py", line 250, in execute
self.errorhandler(self, exc, value)
File "/srv/env/ftc/lib/python3.4/site-packages/MySQLdb/connections.py", line 42, in defaulterrorhandler
raise errorvalue
File "/srv/env/ftc/lib/python3.4/site-packages/MySQLdb/cursors.py", line 247, in execute
res = self._query(query)
File "/srv/env/ftc/lib/python3.4/site-packages/MySQLdb/cursors.py", line 411, in _query
rowcount = self._do_query(q)
File "/srv/env/ftc/lib/python3.4/site-packages/MySQLdb/cursors.py", line 374, in _do_query
db.query(q)
File "/srv/env/ftc/lib/python3.4/site-packages/MySQLdb/connections.py", line 270, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (2006, 'MySQL server has gone away')
[pid: 20|app: 0|req: 1/10] 192.168.1.15 () {40 vars in 701 bytes} [Fri Nov 18 17:16:43 2016] GET /my-programs/ => generated 0 bytes in 258 msecs (HTTP/1.1 500) 0 headers in 0 bytes (1 switches on core 0)
...brutally killing workers...
worker 1 buried after 1 seconds
worker 2 buried after 1 seconds
worker 3 buried after 1 seconds
worker 4 buried after 1 seconds
worker 5 buried after 1 seconds
worker 6 buried after 1 seconds
worker 7 buried after 1 seconds
worker 8 buried after 1 seconds
worker 9 buried after 1 seconds
worker 10 buried after 1 seconds
binary reloading uWSGI...
chdir() to /
closing all non-uwsgi socket fds > 2 (max_fd = 65536)...
found fd 3 mapped to socket 0 (/srv/ftc/ftc.sock)
running /usr/local/bin/uwsgi
[uWSGI] getting INI configuration from /srv/ftc/conf/uwsgi.ini
Thanks in advance for any help!
This is usually a mysql configuration problem. The settings in particular that you want to adjust for your website are:
max_allowed_packet: http://dev.mysql.com/doc/refman/5.7/en/packet-too-large.html
wait_timeout: http://dev.mysql.com/doc/refman/5.7/en/gone-away.html
But if you’ll look at your log, the mysql gone away problem is only during the handling of an exception that is being caused somewhere else. I would try and solve this exception first before trying to tackle the mysql issue
Traceback (most recent call last):
File "/srv/env/ftc/lib/python3.4/site-packages/django/core/urlresolvers.py", line 393, in urlconf_module
return self._urlconf_module
AttributeError: 'RegexURLResolver' object has no attribute '_urlconf_module'
I found the solution. I added lazy-apps to uwsgi.ini. See ningx, uwsgi, python permanent mysql error after some time from starting application
I'm not using sql alchemy but this did fix the mysql server has gone away error.

Jupyter Octave Kernel on Windows7

Followed the instructions at https://github.com/Calysto/octave_kernel to install octave_kernel on a Windows1 machine and everything went ok. However, when I select Octave as my kernal from Jupyter, the following occurs.
The kernel has died, and the automatic restart has failed. It is
possible the kernel cannot be restarted. If you are not able to
restart the kernel, you will still be able to save the notebook, but
running code will no longer work until the notebook is reopened.
I also cannot get oct2py to work.
The Jupyter console output from the octave_kernal attempt follows.
PermissionError: [WinError 5] Access is denied
[I 18:00:38.987 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel f15e40d3-8288-4b9b-bb32-dea6b67484e1 restarted
Traceback (most recent call last):
File "C:\Anaconda3\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "C:\Anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Anaconda3\lib\site-packages\octave_kernel\__main__.py", line 6, in <m
odule>
IPKernelApp.launch_instance(kernel_class=OctaveKernel)
File "C:\Anaconda3\lib\site-packages\traitlets\config\application.py", line 59
5, in launch_instance
app.initialize(argv)
File "<decorator-gen-123>", line 2, in initialize
File "C:\Anaconda3\lib\site-packages\traitlets\config\application.py", line 74
, in catch_config_error
return method(app, *args, **kwargs)
File "C:\Anaconda3\lib\site-packages\ipykernel\kernelapp.py", line 421, in ini
tialize
self.init_kernel()
File "C:\Anaconda3\lib\site-packages\ipykernel\kernelapp.py", line 360, in ini
t_kernel
user_ns=self.user_ns,
File "C:\Anaconda3\lib\site-packages\traitlets\config\configurable.py", line 4
05, in instance
inst = cls(*args, **kwargs)
File "C:\Anaconda3\lib\site-packages\metakernel\process_metakernel.py", line 5
3, in __init__
self._start()
File "C:\Anaconda3\lib\site-packages\metakernel\process_metakernel.py", line 5
8, in _start
self.wrapper = self.makeWrapper()
File "C:\Anaconda3\lib\site-packages\octave_kernel\kernel.py", line 82, in mak
eWrapper
if 'version 4' in self.banner:
File "C:\Anaconda3\lib\site-packages\octave_kernel\kernel.py", line 63, in ban
ner
banner = subprocess.check_output([self.executable, '--version'])
File "C:\Anaconda3\lib\subprocess.py", line 629, in check_output
**kwargs).stdout
File "C:\Anaconda3\lib\subprocess.py", line 696, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Anaconda3\lib\subprocess.py", line 950, in __init__
restore_signals, start_new_session)
File "C:\Anaconda3\lib\subprocess.py", line 1220, in _execute_child
startupinfo)
PermissionError: [WinError 5] Access is denied
[W 18:00:42.002 NotebookApp] KernelRestarter: restart failed
[W 18:00:42.002 NotebookApp] Kernel f15e40d3-8288-4b9b-bb32-dea6b67484e1 died, r
emoving from map.
ERROR:root:kernel f15e40d3-8288-4b9b-bb32-dea6b67484e1 restarted failed!
[W 18:00:42.002 NotebookApp] Kernel deleted before session
[W 18:00:42.002 NotebookApp] 410 DELETE /api/sessions/d25e7956-2a56-4977-a2de-8b
9c3f828a05 (::1) 0.00ms referer=http://localhost:8888/notebooks/Untitled6.ipynb?
kernel_name=octave
I saw the permission error and tried to run Jupyter as an administrator to no avail.
Set enviornment variale OCTAVE_EXECUTABLE as C:\Octave\Octave-4.2.1\bin\octave-cli-4.2.1.exe. Provide full R/W permission to user Everyone on Octave install folder

web2py with MongoHQ deploy at openshift: RuntimeError: no driver available ('pymongo',)

I'm trying to deploy my app to openshift, but I got error message. Following are my logs:
==> app-root/logs/web2py.log <==
127.5.151.1, 2014-06-01 18:08:10, GET, /admin/static/images/questions.png, HTTP/1.1, 304, 0.010710
127.5.151.1, 2014-06-01 18:11:12, HEAD, /, HTTP/1.1, 303, 0.000809
127.5.151.1, 2014-06-01 18:11:13, HEAD, /, HTTP/1.1, 303, 0.004810
127.5.151.1, 2014-06-01 18:41:05, GET, /MarkIt/, HTTP/1.1, 500, 5.459672
127.5.151.1, 2014-06-01 18:49:36, GET, /MarkIt/, HTTP/1.1, 500, 5.658112
127.5.151.1, 2014-06-01 18:54:00, GET, /MarkIt/, HTTP/1.1, 500, 5.682422
127.5.151.1, 2014-06-01 19:10:50, HEAD, /, HTTP/1.1, 303, 0.000960
127.5.151.1, 2014-06-01 19:10:50, HEAD, /, HTTP/1.1, 303, 0.001024
127.5.151.1, 2014-06-01 19:56:22, GET, /MarkIt/, HTTP/1.1, 500, 5.487744
127.5.151.1, 2014-06-01 20:04:03, GET, /MarkIt/, HTTP/1.1, 500, 5.431559
==> app-root/logs/python.log <==
[Sun Jun 01 20:04:02 2014] [error] DEBUG: connect attempt 4, connection error:
[Sun Jun 01 20:04:02 2014] [error] Traceback (most recent call last):
[Sun Jun 01 20:04:02 2014] [error] File "/var/lib/openshift/538b85575973cad5cc000794/app-root/runtime/repo/libs/gluon/dal.py", line 7409, in __init__
[Sun Jun 01 20:04:02 2014] [error] self._adapter = ADAPTERS[self._dbname](**kwargs)
[Sun Jun 01 20:04:02 2014] [error] File "/var/lib/openshift/538b85575973cad5cc000794/app-root/runtime/repo/libs/gluon/dal.py", line 5240, in __init__
[Sun Jun 01 20:04:02 2014] [error] if do_connect: self.find_driver(adapter_args)
[Sun Jun 01 20:04:02 2014] [error] File "/var/lib/openshift/538b85575973cad5cc000794/app-root/runtime/repo/libs/gluon/dal.py", line 746, in find_driver
[Sun Jun 01 20:04:02 2014] [error] raise RuntimeError("no driver available %s" % str(self.drivers))
[Sun Jun 01 20:04:02 2014] [error] RuntimeError: no driver available ('pymongo',)
97.77.53.27 - - [01/Jun/2014:20:03:56 -0400] "GET /MarkIt/ HTTP/1.1" 500 843 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14"
I'm using MongoHQ, the app runs totally fine if I run it locally.
The way I connect to MongoHQ is in db.py:
if not request.env.web2py_runtime_gae:
## if NOT running on Google App Engine use SQLite or other DB
#db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
db = DAL("mongodb://username:password#oceanic.mongohq.com:10017/MarkIt",
check_reserved=["mongodb_nonreserved",], adapter_args={"safe":False})
Only one of my applications in web2py uses MongoHQ and that's the one I could not open. Other work fine.
I think it might be dependency issue but I don't know how to resolve it.
I also did rhc cartridge add mongodb-2.4 -a my app but it does not help.

versatile database connection with django and mysql

I have an issue with my deployed application on an apache2 with mod_wsgi.
The connection process to the database is exactly successful only once out of 2!
I've named the database 'CKP' and for some reason have to change to 'ckp'.
So when I request a page of the application once out of two, I can read in the error log of apache:
mod_wsgi (pid=16098): Target WSGI script '/u1/msc/vg55/public_html/core_knowledge_web_platform/wsgi.py' cannot be loaded as Python module.
mod_wsgi (pid=16098): Exception occurred processing WSGI script '/u1/msc/vg55/public_html/core_knowledge_web_platform/wsgi.py'.
Traceback (most recent call last):
File "/u1/msc/vg55/public_html/core_knowledge_web_platform/wsgi.py", line 20, in <module>
command.validate()
File "/usr/lib/python2.6/site-packages/django/core/management/base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
File "/usr/lib/python2.6/site-packages/django/core/management/validation.py", line 102, in get_validation_errors
connection.validation.validate_field(e, opts, f)
File "/usr/lib/python2.6/site-packages/django/db/backends/mysql/validation.py", line 14, in validate_field
db_version = self.connection.get_server_version()
File "/usr/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 338, in get_server_version
self.cursor()
File "/usr/lib/python2.6/site-packages/django/db/backends/__init__.py", line 250, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "/usr/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 322, in _cursor
self.connection = Database.connect(**kwargs)
File "/usr/lib64/python2.6/site-packages/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (1044, "Access denied for user 'ckpuser'#'%' to database 'CKP'")
If it could help, I've integrated the improved WSGI script for use with Django given by Graham Dumpleton in his blog.
Thanks for any suggestion.