apache2 mod_wsgi crashes when importing pyodbc - apache

Operating system - Ubuntu Server 14.04 on Azure VM
Tried with different versions of python (3.4.3, 3.6.0), apache and mod_wsgi.
Installed MS Native ODBC driver using instructions from here
https://gist.github.com/joecampo/6f777a659b8132b9d6fe1c3589df394c , while pyodbc was installed using pip.
To debug the wsgi_module I have set up the django application to run in embedded mode and:
gdb /usr/local/apache2/bin/httpd
run -X
When I access any function which imports pyodbc, the wsgi fails with the following error:
Program received signal SIGSEGV, Segmentation fault.
import_types () at src/pyodbcmodule.cpp:223
223 src/pyodbcmodule.cpp: No such file or directory.
Importing module works fine when I run the django app from the command line:
python3 manage.py runserver
Is there a workaround?

I experienced the same problem when setting up a Python Pyramid project, and downgrading to a previous version of pyodbc fixed it.
It looks like this may be a bug in pyodbc or the WSGI module. See pyodbc 4.0.9+ segfault with uwsgi #199. You may already be aware that this line is a red herring:
223 src/pyodbcmodule.cpp: No such file or directory.
That error is coming from the debugger and just tells where in import_types() the exception was raised, however searching for that file led me to that bug report on GitHub.
You obviously already know how to debug Apache and wsgi, but for anyone who doesn't there are detailed instructions here.

This has been fixed in 4.0.16 by adding support for subinterpreters.

Related

Gazebo GUI Not Showing Up when running WSL2 Graphics on Windows 11

I am attempting to use ROS with the Gazebo GUI. I recently upgraded to Windows 11 for the WSL GUI support and have the gedit GUI working. However, when I run the command $ gazebo, the GUI does not open.
Running $ gazebo --verbose gives the following error messages
[Err] [RenderEngine.cc:749] Can't open display: :0
[Err] [GuiIface.cc:124] This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.
After enabling the QT Debug environment variable using export export QT_DEBUG_PLUGINS=1 and rerunning the gazebo command with the verbose option set, It shows me
[Dbg] [GuiIface.cc:112] Got keys from plugin meta data ("xcb")
[Dbg] [GuiIface.cc:112] QFactoryLoader::QFactoryLoader() checking directory path "/usr/bin/platforms" ...
[Dbg] [GuiIface.cc:112] loaded library "/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so"
I believe that I have all of the necessary packages installed from this output, so I am wondering why gazebo is not showing up. I have tried uninstalling/reinstalling gazebo to no avail.
Thank you so much for your time. If I get this problem sorted out, I will post. Please let me know if any other system/output information is needed.
Other information:
I am not using X Server because the Windows 11 upgrade does not require it for graphical WSL applications (but did try it with X Server installed just in case)
I have tinkered around with the ~/.bashrc profile. DISPLAY=0:0 option was set, but I deleted this because Windows 11 did not need it (or so I think?)
Solution:
After reading up online, I found this answer to a similar question to mine.
https://superuser.com/questions/1681647/windows-11-wsl-not-opening-gui-in-my-ubuntu-shell
Getting ubuntu and re-installing gazebo on that worked. Now I can open up the Gazebo GUI.

Psychopy stack smashing detected

I am trying to execute the following basic psychopy (version 2021.2.3) code through the Python 3.6.13 console:
import psychopy.visual as pv
pv.Window()
Which gives the following error.
*** stack smashing detected ***: <unknown> terminated
Aborted (core dumped)
The only related topic I can find is on the psychopy forum with no answers
I'm running this on an Ubuntu 18.04.05 machine. The machine is initialized as a headless server, but I am trying to run this through RDP.
I installed psychopy using pip inside a conda environment. Initially I was getting errors related to wxPython. When I manually installed wxPython from a whl file that error was resolved and error in this question appeared.
My guess is that this is to do with the version of one of the libraries but very hard to tell from this limited info.
What version of PsychoPy are you trying to install and by what means are you installing it? Are you running from the app or is this a script you're trying to launch from the terminal? ie. trying to work out what parts of PsychoPy this is affecting (the app, the visual lib, the gui libs...?)
I had a very similar problem on ubuntu 18.04.5, psychopy 3.2.4, no headless server. I suspect that the problem is general but ubuntu/drivers related.
My solution was to update the system and to install&switch to a proprietary NVIDIA driver.

Running Selenium/PhantomJS inside a Vagrant box

I'm trying to set up testing for a Web app using behaving, which runs on top of behave and splinter - the latter of which in turn uses Selenium to drive PhantomJS. All of this is inside a VirtualBox-provided Vagrant box running CentOS 6.4. I've installed Selenium via pip, and I've installed PhantomJS from the Nux Dextop repo.
Trying to run my tests freezes Behave for 30 seconds, then raises:
selenium.common.exceptions.WebDriverException: Message: 'Can not connect to GhostDriver'
I think I've nailed it down to not being able to open a socket, and indeed, when I try to do this from the Python interactive shell, I can't open any socket to localhost at all. How do I get my tests to run?
I just had the same problem with the Can not connect to GhostDriver error. When trying phantomjs --help, I got the error
[WARNING] Unable to load library icui18n "Cannot load library icui18n: (libicui18n.so.48: cannot open shared object file: No such file or directory)"
After installing libicu48 (Ubuntu package), phantomjs --help gave me
[WARNING] phantomjs: cannot connect to X server
This made sense, since I didn't have an X server installed. Then, I discovered that phantomjs <= 1.4 requires an X server, but >= 1.5 is pure headless. So, instead of relying on my distro's phantomjs package, I installed it using npm, and now everything works fine.
I have installed the package of libicu48 and gnome-session-fallback for the bug.
$ sudo apt-get install libicu48 gnome-session-fallback

Getting "not a dynamic executable" running "ldd mod_wsgi.o" on CentOS 5.5

I've installed Python 2.7.1 on 64-bit CentOS 5.5 and compiled mod_wsgi against 2.7.1. I'm building a DJango web application and need Python modules from 2.7 (CentOS built-in version of Python is only 2.4.3 and sorely lacking). I've basically followed the procedure on this great link:
http://willsani.com/2011/03/02/centos-5-5-x86_64-install-python-2-7/
So, I've now got a working version of Python 2.7.1 installed in /opt/python2.7.1. But, when I install my mod_wsgi.o module in Apache, Apache fails to start with:
Cannot load /etc/httpd/modules/mod_wsgi.so into server:
/etc/httpd/modules/mod_wsgi.so: only ET_DYN and ET_EXEC can be loaded
So, I ran the ldd command against my version of mod_wsgi.o and, instead of seeing the expected list of shared libraries, I see:
[root#ac5w15tps01 modules]# ldd mod_wsgi.o
not a dynamic executable
Currently, my web application is running with mod_wsgi working fine against Python 2.4.3. Someone else set that up so not sure if they needed to do anything special - I inherited the setup. I've read everything related to building and installing mod_wsgi from http://code.google.com/p/modwsgi/ and searched the web for answers. Can't see to find anything on this error.
Any help would be greatly appreciated!

Paramiko in Apache : DLL load failed

I have a Django app that uses Paramiko to communicate with other remote servers.
Paramiko relies on module winrandom, but that won't install on windows without gcc, so instead I use winrandom-ctypes.
This all works fine from development, but when I deploy to Apache (also on Windows), it fails on import winrandom, with this error:
DLL load failed: The specified module could not be found.
So...how can I make this work under Apache?
I've got the same problem with pyCrypton 2.3. Switching back to 2.1 seems to fix it.