Got a SIGABRT while executing native code - error when running xsp4 on AWS during Cloudformation - amazon-web-services

I'm getting an error when starting the xsp4 server on an AWS Ubuntu AMI. The error is initialize: mono_thread_create_internal () failed, and then:
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
The same command executes without errors on my own computer. Any idea what the error is - maybe a missing package, some configuration or something like that?
Edit: Huh, that's weird, it's working when I log in via ssh and manually run the command. I need to run it during CloudFormation however, and it fails there. Maybe something isn't fully setup yet during CloudFormation, or the user account is different? But on second thought, doesn't CloudFormation run as root?
Full log:
+ xsp4 --port 80
Cloud-init v. 0.7.9 running 'modules:final' at Sun, 22 Oct 2017 17:18:30 +0000. Up 12.78 seconds.
Cloud-init v. 0.7.9 finished at Sun, 22 Oct 2017 17:19:27 +0000. Datasource DataSourceEc2. Up 69.50 seconds
xsp4
Listening on address: 0.0.0.0
Root directory: /var/www/HelloWebApi
Listening on port: 80 (non-secure)
Hit Return to stop the server.
The server is not started.
at Mono.WebServer.ApplicationServer.Stop () in :0
at (wrapper remoting-invoke-with-check) Mono.WebServer.ApplicationServer:Stop ()
at Mono.WebServer.XSP.Server.DebugMain (System.String[] args, Boolean root, IApplicationHost ext_apphost, Boolean quiet) in :0
initialize: mono_thread_create_internal () failed
Stacktrace:
at
at (wrapper managed-to-native) System.Net.Sockets.Socket.socket_pool_queue (System.Net.Sockets.SocketAsyncCallback,System.Net.Sockets.SocketAsyncResult)
at System.Net.Sockets.Socket.QueueSocketAsyncResult (System.Collections.Generic.Queue`1,System.Net.Sockets.SocketAsyncWorker,System.Net.Sockets.SocketAsyncResult)
at System.Net.Sockets.Socket.AcceptAsync (System.Net.Sockets.SocketAsyncEventArgs)
at Mono.WebServer.ApplicationServer.RunServer ()
at System.Threading.ThreadHelper.ThreadStart_Context (object)
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object)
at System.Threading.ThreadHelper.ThreadStart ()
at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr)
Native stacktrace:
/usr/bin/mono() [0x49ff2f]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390) [0x7f39c549b390]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38) [0x7f39c50f5428]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f39c50f702a]
/usr/bin/mono() [0x630409]
/usr/bin/mono() [0x63069c]
/usr/bin/mono() [0x63076f]
/usr/bin/mono() [0x58e6e5]
[0x4044ec36]
Debug info from gdb:
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

If it works after SSH and not directly they most probably it is a TTY missing issue. If your server requires TTY then it won't start this way
As you mentioned in your response that xsp4 waits for enter key to exit and take --nonstop if you don't want the behavior, then you should use that arg. It will make sure the TTY is not required.
In case if a executable actually still requires TTY then you can look at the script command. Which does allocate a TTY and execute the command. See below for more details
http://man7.org/linux/man-pages/man1/script.1.html

Related

Can't download a file via os.system('scp (...)') whithin a python script launched via a init script

I'm trying to download a remote file using the scp command called by os.system() in a Python script (scp.py) started as a service by a procd init script.
This script is running on OpenWrt 15.05.1 (which uses BusyBox to implement the shell environment). SCP itself is handled by dropbear SSH (https://matt.ucc.asn.au/dropbear/dropbear.html)
The code is quite simple :
import os
import logging
logging.basicConfig(level=logging.DEBUG, filename='/usr/local/www/log/scp_test.log', filemode = 'w')
rc = os.system('scp -i /root/.ssh/id_rsa root#vps500141.ovh.net:/root/simon/test /tmp/hello')
error_code, signal = rc >> 8, rc & 0xFF
logging.debug('error_code -> {}'.format(error_code))
logging.debug('signal -> {}'.format(signal))
When launched in the terminal using the command "python scp.py", the program's behave well. The download is successful and produces the following output :
root#S096C08:/usr/local/bin# python scp.py
test 100% 24 0.0KB/s 00:00
root#S096C08:/usr/local/bin# cat /usr/local/www/log/scp_test.log
DEBUG:root:error_code -> 0
DEBUG:root:signal -> 0
But this program fails to download anything when launched as a service using the command /etc/init.d/scp_test start
root#S096C08:/usr/local/bin# /etc/init.d/scp_test start
root#S096C08:/usr/local/bin# cat /usr/local/www/log/scp_test.log
DEBUG:root:error_code -> 1
DEBUG:root:signal -> 0
Furthermore, a quick investigation of the syslogs using the logread command shows this :
Wed May 15 10:24:58 2019 daemon.err python[3156]: Host 'vps500141.ovh.net' is not in the trusted hosts file.
Wed May 15 10:24:58 2019 daemon.err python[3156]: (ssh-rsa fingerprint md5 41:aa:2b:57:48:be:01:81:48:a3:d0:ac:b6:56:16:34)
Wed May 15 10:24:58 2019 daemon.err python[3156]: Do you want to continue connecting? (y/n)
Wed May 15 10:24:58 2019 daemon.err python[3156]: /usr/bin/dbclient: Connection to root#vps500141.ovh.net:22 exited: Didn't validate host key
vps500141.ovh.net already have an entry in /root/.ssh/known_hosts so this is quite surprising that it is not found when the script is running.
I've also tried to add the "-o StrictHostKeyChecking=no" option to the scp command but it doesn't seems to work either.
NB : this is the content of the init script /etc/init.d/scp_test
#!/bin/sh /etc/rc.common
# Copyright (C) 2015 CZ.NIC z.s.p.o. (http://www.nic.cz/)
START=99
STOP=0
USE_PROCD=1
SCRIPT="/usr/local/bin/scp.py"
start_service() {
procd_open_instance
procd_set_param user root
procd_set_param command python "$SCRIPT"
procd_set_param stderr 1
procd_close_instance
}
Problem resolved after moving /root/.ssh/known_hosts to /.ssh/known_hosts

Gdb can't connect to OpenOCD on stm32

Trying to debug my sample blink_led code on STM32L476 Nucleo-64 board but gdb can't connect to OpenOCD (connection drops almost instantly with error). I've read plenty of posts here and there but none of them helped. Tried adding commands to OpenOCD using -c but no change of behavior.
My code compiles both in Release and Debug config in Eclipse. I can flash the bin file using drag and drop (while the board has built-in STLink add-on) and looks the code runs perfectly on the board (LED blinks).
Cross compiling on Centos7 using the following versions:
Toolchain (gdb): gcc-arm-none-eabi-8-2018-q4-major
OpenOCD: 0.10.0-11-20190118-1134
As using eclipse didn't work I tried the command line,
(I'm not an experienced developer in this environment so I could not find any config file closer to my stm32l476 board than the stm32l4discovery.cfg, please let me know if there might be some issues using it)
./bin/openocd -f scripts/board/stm32l4discovery.cfg -c "init"
It starts,
GNU MCU Eclipse 64-bit Open On-Chip Debugger 0.10.0+dev-00462-gdd1d90111 (2019-01-18-11:37)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 500 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : clock speed 500 kHz
Info : STLINK V2J28M17 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.244386
Info : stm32l4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Then starting GDB:
./arm-none-eabi-gdb ~/eclipse-workspace/test-blink-led/Debug/test-blink-led.elf
then running the following command in gdb:
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
Remote connection closed
As it shows gdb connection drops instantly and OpenOCD prompts the following errors:
Info : accepting 'gdb' connection on tcp/3333
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080022e6 msp: 0x20017ff8
Info : device id = 0x10076415
Warn : STM32 flash size failed, probe inaccurate - assuming 1024k flash
Info : flash size = 1024kbytes
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.
Error: attempted 'gdb' connection rejected
Error: jtag status contains invalid mode value - communication failure
Polling target stm32l4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
So from those geeks who do it on a similar platform on a daily basis, can anyone help and tell me where am I doing wrong. Does missing any compile-time flag might result in this problem?
I'm scratching my head for a couple of days now so please let me have your hints.
One of the reasons may be that your STLINK firmware seems pretty old (STLINK V2J28M17 as your log shows). I suggest downloading the STSW-LINK007 application to upgrade the firmware. The software is a multiplatform Java application. It works flawlessly in Debian GNU/Linux.
Currently, I use another gdb server texane/stlink for my debugging task with GDB without any problem on some Nucleo and also custom boards. I use target extended-remote command to join the port of the server. Maybe you can try to connect with this command also under OpenOCD.
Try
telnet localhost 4444
it worked for me, while 3333 didn't

How to solve assertion error in libopal?

I just wrote a script that calls a project I got from github that calls a normal telephone number and during development I ran the script without a problem. But deploying it on my server and testing it there I get the following error message
Starting sipcmd
in debug mode
Manager
Init
initialising SIP endpoint...
TestChanAudio
TestChanAudio
Listening for SIP signalling on 0.0.0.0:5060
assert.cxx(112) PWLib Assertion fail: Function pthread_setschedparam failed, file ptlib/unix/tlibthrd.cxx, line 745, Error=1
Assertion fail: Function pthread_setschedparam failed, file ptlib/unix/tlibthrd.cxx, line 745, Error=1
<A>bort, <C>ore dump, <T>hrow exception, <I>gnore?
Both machines are running linux and every single library is perfectly installed.
Does someone know how to fix this?
The error code is EPERM so according to the documentation the user running your application doesn't have permission to set the specified policy.
The policy only allows setting the scheduler priority so I guess the application is asking for a priority higher than the user is allowed to use? This question may hold some clues on how to fix this: Why does pthread_setschedparam() produce EPERM on opensuse 11.4

vtkXOpenGLRenderWindow error in a terminal in VNC

I run a vnc server on my workstation and connect with another computer. Both of the server and client are running Debian Jessie:
$ uname -a
Linux debian-VAIO 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u2 (2016-06-25) x86_64 GNU/Linux
Xfce is installed for the vnc server and xstartup is:
$ cat ~/.vnc/xstartup
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1
exec startxfce4
In the ~/.bashrc, I have added the lines below:
export LIBGL_ALWAYS_INDIRECT=y
export LD_PRELOAD='/usr/lib/x86_64-linux-gnu/libstdc++.so.6'
Currently, when I ssh to the server with ssh -X, the $DISPLAY is localhost:10.0, and the vtk related command will launch an X window. However, if a vnc server is launched in the ssh terminal, logging into xfce and opening a terminal in it, the $DISPLAY is :1.0 and vtk fails to launch an X window, with the following message:
Error: In /home/orobix/Desktop/vmtk-build/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx, line 394
vtkXOpenGLRenderWindow (0x2c30f10): Could not find a decent visual
Error: In /home/orobix/Desktop/vmtk-build/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx, line 394
vtkXOpenGLRenderWindow (0x2c30f10): Could not find a decent visual
Error: In /home/orobix/Desktop/vmtk-build/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx, line 394
vtkXOpenGLRenderWindow (0x2c30f10): Could not find a decent visual
Error: In /home/orobix/Desktop/vmtk-build/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx, line 613
vtkXOpenGLRenderWindow (0x2c30f10): GLX not found. Aborting.
I think it might be relate to the missed config of X server in xstartup of vnc server. But I don't know how to do it. Could anyone help me debug it? Any further information will be provided if needed. Thanks!
20160823 Update
I accepted the suggestion of VirtualGL + TurboVNC and installed the two components. A simple config using vglserver_config was done according to http://www.virtualgl.org/vgldoc/2_1_1/#hd009001 part 6.1. Then I made vncserver of TurboVNC to run xfce with xstartup.turbovnc:
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
OS=`uname -s`
exec startxfce4
On the client, I use vncviewer of TurboVNC to connect the server. The desktop looks quite different from that in a default vncserver. Then I tried
/opt/VirtualGL/bin/vglrun vmtkimageviewer -ifile image_volume_voi.vti
in which the vmtkimageviewer should open up a window, but finally it gives out an error:
Executing vmtkimageviewer ...
X Error of failed request: GLXBadContext
Major opcode of failed request: 156 (GLX)
Minor opcode of failed request: 6 (X_GLXIsDirect)
Serial number of failed request: 17
Current serial number in output stream: 16
And unfortunately, I find that with ssh -X, I cannot launch the X window as I did before, although $DISPLAY is still localhost:10.0. The output is:
Executing vmtkimageviewer ...
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 156 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Value in failed request: 0x0
Serial number of failed request: 37
Current serial number in output stream: 38
But I think I am closer to the fact, as it looks like VirtualGL works(?). What to do for the next?
Plain and simple the X server variant that's being used by Xrdp (either Xvnc or Xvfb) simply doesn't support OpenGL / GLX and thus programs that need OpenGL will not work in that configuration.
Fallback to Mesa swrast or llvmpipe is possible though: http://www.mesa3d.org/llvmpipe.html
Finally, I got everything done. VirtualGL only is enough for my purpose. Just install and config as the section 6.2 & 6.3 in its user's guide. Use the default vncserver and vncviewer as usual, TurboVNC is not needed. Use vglrun when you need an OpenGL support. One modification is that I should remove export LIBGL_ALWAYS_INDIRECT=y in my .bashrc.
It runs fluent in my case. #datenwolf: Thank you again!

running vssadmin from a program

I'm trying to run the following command from a c++ program:
system("vssadmin list writers > tmp.txt ");
I'm getting this output:
"vssadmin 1.1 - Volume Shadow Copy Service administrative command-line tool (C) Copyright 2001-2005 Microsoft Corp.
Error: A Volume Shadow Copy Service component encountered an unexpected error. Check the Application event log for more information.
in the event log there are 2 errors: 22 and 8193.
if I run it directly from the command line it works fine.
Thanks.
The problem was that I was running a 32 bit application on a 64 bit machine thus windows was redirecting the app to the wrong vssadmin.
http://msdn.microsoft.com/en-us/library/aa384187
http://msdn.microsoft.com/en-us/library/aa365743