Puppeteer and Docker for Mac (Apple M1) - docker

Chromium is crashing when opened via puppeteer navigation with the following stack trace on my M1. I'm looking for some help from the community as non m1 based machines don't seem to have an issue with our puppeteer container.
[0613/204124.018517:ERROR:stack_trace_posix.cc(707)] Failed to parse the contents of /proc/self/maps
[0613/204124.746267:ERROR:stack_trace_posix.cc(707)] Failed to parse the contents of /proc/self/maps
[0613/204124.751355:ERROR:stack_trace_posix.cc(707)] Failed to parse the contents of /proc/self/maps
[0613/204124.981155:FATAL:nacl_helper_linux.cc(440)] Check failed: nacl_sandbox->IsSingleThreaded().
qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
[130:130:0613/204125.140482:FATAL:zygote_main_linux.cc(162)] Check failed: sandbox::ThreadHelpers::IsSingleThreaded().
#0 0x0040072b9339 <unknown>
#1 0x00400722ff23 <unknown>
#2 0x00400722d070 <unknown>
#3 0x00400722dc6e <unknown>
#4 0x004006dae926 <unknown>
#5 0x004006da973e <unknown>
#6 0x004006daa369 <unknown>
#7 0x004006dab0cb <unknown>
#8 0x004006da838e <unknown>
#9 0x004006da8d4e <unknown>
#10 0x0040036e1227 <unknown>
#11 0x00400faba0b3 <unknown>
#12 0x0040036e102a <unknown>
Crash keys:
"switch-7" = "--enable-crashpad"
"switch-6" = "--change-stack-guard-on-fork=enable"
"switch-5" = "--user-data-dir=/tmp/puppeteer_dev_chrome_profile-5BphEe"
"switch-4" = "--enable-crash-reporter=,"
"switch-3" = "--crashpad-handler-pid=117"
"switch-2" = "--enable-crashpad"
"switch-1" = "--no-sandbox"
"num-switches" = "8"
qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
[112:138:0613/204125.830241:ERROR:file_path_watcher_inotify.cc(329)] inotify_init() failed: Function not implemented (38)
[0613/204125.946536:ERROR:scoped_ptrace_attach.cc(27)] ptrace: Function not implemented (38)
Assertion failed: p_rcu_reader->depth != 0 (/qemu/include/qemu/rcu.h: rcu_read_unlock: 101)
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
Error scraping url: <my - url>:
Error: Unable to launch chrome
I'm launching puppeteer with the following options:
const args = [
'--no-first-run',
'--no-sandbox',
'--disable-setuid-sandbox',
'--single-process',
'--disable-dev-shm-usage',
'--ignore-certificate-errors',
'--ignore-urlfetcher-cert-requests',
'--disable-blink-features=AutomationControlled'
];
And I'm installing chromium into by ubuntu based container via:
# Install Chrome for Ubuntu
RUN apt-get update \
&& apt-get install -y chromium-browser
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium

Spent all day trying to fix it. In the end running docker with colima solved the issue. The thing is that some stuff simply will not work on arm and there is no point in fighting it. Colima allows you to run everything via Rosetta, hence emulating x86 all the way.
First install colima with brew install colima.
Shut down docker desktop if it's running.
Start colima with colima start --arch aarch64 --vm-type=vz (check readme for more info)
Now you have docker running fully via Rossetta. When running images, use "--platform linux/amd64".

Related

Dart libserial is unable to open `/dev/pts` devices

I am monitoring a serial device via a jpevulator:
jpnevulator --read --ascii --tty /dev/ttyACM0 --pty --pass --read --ascii --timing-print
jpnevulator: slave pts device is /dev/pts/3.
jpnevulator: Use --read or --write, but not both. Performing a read this time.
**strong text**
And I made a simple programm that sends a string and reads from the serial port as well:
import 'package:libserialport/libserialport.dart';
import 'dart:typed_data';
void main(List<String> arguments) {
final port = SerialPort("/dev/pts/3");
if (!port.openReadWrite()) {
print(SerialPort.lastError);
}
port.write(Uint8List.fromList("Lorem Ipsum".codeUnits));
final reader = SerialPortReader(port);
reader.stream.listen((data) {
print('received: $data');
});
}
But I get the error once I dart run it:
Building package executable...
Built serial:serial.
Unhandled exception:
SerialPortError: No such file or directory, errno = 2
#0 Util.call (package:libserialport/src/util.dart:39:7)
#1 _SerialPortImpl._init (package:libserialport/src/port.dart:221:10)
#2 new _SerialPortImpl (package:libserialport/src/port.dart:211:42)
#3 new SerialPort (package:libserialport/src/port.dart:72:38)
#4 main (file:///mnt/data/Kwdikas/dart/serial/bin/serial.dart:5:16)
#5 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)
#6 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
Any idea why? I am running it on linux mint. I am using flutter installed dart that is shipped as snap:
$ whereis dart
dart: /usr/bin/dart /usr/lib/dart /snap/bin/dart
And I have installed it using classic confinement:
sudo snap install flutter --classic

libserial is not detected in my dart programm

I made a minimalistic dart software that interfaces a serial port:
import 'package:libserialport/libserialport.dart';
import 'dart:typed_data';
void main(List<String> arguments) {
final port = SerialPort("/dev/pts/4");
if (!port.openReadWrite()) {
print(SerialPort.lastError);
}
port.write(Uint8List.fromList("Lorem Ipsum".codeUnits));
final reader = SerialPortReader(port);
reader.stream.listen((data) {
print('received: $data');
});
}
But once I run:
dart run
I get the following error:
Unhandled exception:
Invalid argument(s): Failed to load dynamic library 'libserialport.so': libserialport.so: cannot open shared object file: No such file or directory
#0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:12:43)
#1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:23:12)
#2 dylib
package:libserialport/src/dylib.dart:32
#3 _SerialPortImpl._init.<anonymous closure>
package:libserialport/src/port.dart:221
#4 Util.call
package:libserialport/src/util.dart:37
#5 _SerialPortImpl._init
package:libserialport/src/port.dart:221
#6 new _SerialPortImpl
package:libserialport/src/port.dart:211
#7 new SerialPort
package:libserialport/src/port.dart:72
#8 main
bin/serial.dart:5
#9 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)
#10 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
Exited (255)
I run it in a linux machine.
The problem as you see in the error message is that expects somewhere to be found the libserial.so library.
First and formemost we need to locate the library and see if it is installed:
ldconfig -p | grep libserial
At no output you can install it as you can see here. For linux mint and debian based distros run:
sudo apt-get install libserial0
Then re-run the command:
ldconfig -p | grep libserial
If the command after the installation has an output then you must check if the path is /lib/libserialport.so. In my case it was not:
libserialport.so.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libserialport.so.0
Sometimes after so in librarie's names a number may be appended. In that case we can symlink the libary to the /usr/lib path like that:
sudo ln -s /usr/lib/x86_64-linux-gnu/libserialport.so.0 /usr/lib/libserialport.so
Also, another case is if the library is not located to /usr/lib/libserial.so but in a subfolder inside the /usr/lib path.
The issue is the dynamic library is unable able to load from the system. The solution is
Install libserialport-dev package
for Debian based system use
sudo apt install libserialport-dev
Note: The dart package libserialport uses FFI to access the native API. Under the hood it uses libserialport a minimal, cross-platform shared library written in C. The package actually contain the c code. when we build or run the application it's supposed to be compiled it to libserial.so, but due to some reason this doesn't happen when we use this package directly.
If you use flutter framework use flutter_libserialport package, this take care of creating the .so file without any issue

Docker build vs Docker run don't behave the same

I try to build a Docker image with an Archlinux base.
The problem is that I don't have the same result when building the docker image and when doing commands by hand.
$ cat Dockerfile
FROM archlinux/base
RUN pacman -Suy --noconfirm --noprogressbar
$ docker build .
#1 [internal] load .dockerignore
#1 transferring context: 2B done
#1 DONE 0.3s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 37B done
#2 DONE 0.2s
#3 [internal] load metadata for docker.io/archlinux/base:latest
#3 DONE 0.0s
#4 [1/2] FROM docker.io/archlinux/base
#4 CACHED
#5 [2/2] RUN pacman -Suy --noconfirm --noprogressbar
#5 0.692 :: Synchronizing package databases...
#5 1.449 downloading core.db...
#5 3.139 downloading extra.db...
#5 8.344 downloading community.db...
#5 15.38 :: Starting full system upgrade...
#5 15.40 resolving dependencies...
#5 15.55 looking for conflicting packages...
#5 15.56
#5 15.56 Packages (26) archlinux-keyring-20200820-1 bash-5.0.018-1 ca-certificates-mozilla-3.56-1 curl-7.72.0-2 file-5.39-1 filesystem-2020.08.21-1 gcc-libs-10.2.0-1 glib2-2.64.5-1 glibc-2.32-3 hwids-20200813.1-1 iana-etc-20200812-1 kbd-2.3.0-2 libcap-2.42-1 libgpg-error-1.39-1 libp11-kit-0.23.21-1 libutil-linux-2.36-2 libxcrypt-4.4.17-1 linux-api-headers-5.7-1 p11-kit-0.23.21-1 pacman-mirrorlist-20200801-1 pam-1.4.0-3 pambase-20200721.1-2 sqlite-3.33.0-2 systemd-246.3-1 systemd-libs-246.3-1 util-linux-2.36-2
#5 15.56
#5 15.56 Total Download Size: 63.83 MiB
#5 15.56 Total Installed Size: 297.78 MiB
#5 15.56 Net Upgrade Size: 7.41 MiB
#5 15.56
#5 15.56 :: Proceed with installation? [Y/n]
#5 15.56 :: Retrieving packages...
#5 15.94 downloading archlinux-keyring-20200820-1-any.pkg.tar.zst...
#5 18.60 downloading linux-api-headers-5.7-1-any.pkg.tar.zst...
#5 21.09 downloading iana-etc-20200812-1-any.pkg.tar.zst...
#5 23.08 downloading filesystem-2020.08.21-1-x86_64.pkg.tar.zst...
#5 23.73 downloading glibc-2.32-3-x86_64.pkg.tar.zst...
#5 30.46 downloading gcc-libs-10.2.0-1-x86_64.pkg.tar.zst...
#5 38.65 downloading bash-5.0.018-1-x86_64.pkg.tar.zst...
#5 42.37 downloading libp11-kit-0.23.21-1-x86_64.pkg.tar.zst...
#5 44.24 downloading libcap-2.42-1-x86_64.pkg.tar.zst...
#5 44.99 downloading libgpg-error-1.39-1-x86_64.pkg.tar.zst...
#5 46.48 downloading systemd-libs-246.3-1-x86_64.pkg.tar.zst...
#5 48.72 downloading p11-kit-0.23.21-1-x86_64.pkg.tar.zst...
#5 50.07 downloading ca-certificates-mozilla-3.56-1-x86_64.pkg.tar.zst...
#5 52.28 downloading libutil-linux-2.36-2-x86_64.pkg.tar.zst...
#5 54.72 downloading curl-7.72.0-2-x86_64.pkg.tar.zst...
#5 57.60 downloading glib2-2.64.5-1-x86_64.pkg.tar.zst...
#5 60.93 downloading hwids-20200813.1-1-any.pkg.tar.zst...
#5 63.00 downloading pambase-20200721.1-2-any.pkg.tar.zst...
#5 63.38 downloading pam-1.4.0-3-x86_64.pkg.tar.zst...
#5 65.26 downloading kbd-2.3.0-2-x86_64.pkg.tar.zst...
#5 68.25 downloading pacman-mirrorlist-20200801-1-any.pkg.tar.zst...
#5 68.63 downloading sqlite-3.33.0-2-x86_64.pkg.tar.zst...
#5 72.16 downloading libxcrypt-4.4.17-1-x86_64.pkg.tar.zst...
#5 73.20 downloading file-5.39-1-x86_64.pkg.tar.zst...
#5 75.09 downloading util-linux-2.36-2-x86_64.pkg.tar.zst...
#5 79.08 downloading systemd-246.3-1-x86_64.pkg.tar.zst...
#5 85.13 checking keyring...
#5 85.28 checking package integrity...
#5 86.18 loading package files...
#5 86.21 checking for file conflicts...
#5 86.21 checking available disk space...
#5 86.23 error: Partition /etc/resolv.conf is mounted read only
#5 86.23 error: Partition /etc/hosts is mounted read only
#5 86.23 error: not enough free disk space
#5 86.23 error: failed to commit transaction (not enough free disk space)
#5 86.24 Errors occurred, no packages were upgraded.
#5 ERROR: executor failed running [/bin/sh -c pacman -Suy --noconfirm --noprogressbar]: runc did not terminate sucessfully
------
> [2/2] RUN pacman -Suy --noconfirm --noprogressbar:
------
failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed running [/bin/sh -c pacman -Suy --noconfirm --noprogressbar]: runc did not terminate sucessfully
This fails, I don't understand why.
Same command in a fresh container:
$ docker run --rm archlinux/base pacman -Suy --noconfirm --noprogressbar
:: Synchronizing package databases...
downloading core.db...
downloading extra.db...
downloading community.db...
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...
Packages (26) archlinux-keyring-20200820-1 bash-5.0.018-1 ca-certificates-mozilla-3.56-1 curl-7.72.0-2 file-5.39-1 filesystem-2020.08.21-1 gcc-libs-10.2.0-1 glib2-2.64.5-1 glibc-2.32-3 hwids-20200813.1-1 iana-etc-20200812-1 kbd-2.3.0-2 libcap-2.42-1 libgpg-error-1.39-1 libp11-kit-0.23.21-1 libutil-linux-2.36-2 libxcrypt-4.4.17-1 linux-api-headers-5.7-1 p11-kit-0.23.21-1 pacman-mirrorlist-20200801-1 pam-1.4.0-3 pambase-20200721.1-2 sqlite-3.33.0-2 systemd-246.3-1 systemd-libs-246.3-1 util-linux-2.36-2
Total Download Size: 63.83 MiB
Total Installed Size: 297.78 MiB
Net Upgrade Size: 7.41 MiB
:: Proceed with installation? [Y/n]
:: Retrieving packages...
downloading archlinux-keyring-20200820-1-any.pkg.tar.zst...
downloading linux-api-headers-5.7-1-any.pkg.tar.zst...
downloading iana-etc-20200812-1-any.pkg.tar.zst...
downloading filesystem-2020.08.21-1-x86_64.pkg.tar.zst...
downloading glibc-2.32-3-x86_64.pkg.tar.zst...
downloading gcc-libs-10.2.0-1-x86_64.pkg.tar.zst...
downloading bash-5.0.018-1-x86_64.pkg.tar.zst...
downloading libp11-kit-0.23.21-1-x86_64.pkg.tar.zst...
downloading libcap-2.42-1-x86_64.pkg.tar.zst...
downloading libgpg-error-1.39-1-x86_64.pkg.tar.zst...
downloading systemd-libs-246.3-1-x86_64.pkg.tar.zst...
downloading p11-kit-0.23.21-1-x86_64.pkg.tar.zst...
downloading ca-certificates-mozilla-3.56-1-x86_64.pkg.tar.zst...
downloading libutil-linux-2.36-2-x86_64.pkg.tar.zst...
downloading curl-7.72.0-2-x86_64.pkg.tar.zst...
downloading glib2-2.64.5-1-x86_64.pkg.tar.zst...
downloading hwids-20200813.1-1-any.pkg.tar.zst...
downloading pambase-20200721.1-2-any.pkg.tar.zst...
downloading pam-1.4.0-3-x86_64.pkg.tar.zst...
downloading kbd-2.3.0-2-x86_64.pkg.tar.zst...
downloading pacman-mirrorlist-20200801-1-any.pkg.tar.zst...
downloading sqlite-3.33.0-2-x86_64.pkg.tar.zst...
downloading libxcrypt-4.4.17-1-x86_64.pkg.tar.zst...
downloading file-5.39-1-x86_64.pkg.tar.zst...
downloading util-linux-2.36-2-x86_64.pkg.tar.zst...
downloading systemd-246.3-1-x86_64.pkg.tar.zst...
checking keyring...
checking package integrity...
loading package files...
checking for file conflicts...
checking available disk space...
:: Processing package changes...
upgrading archlinux-keyring...
==> Appending keys from archlinux.gpg...
==> Locally signing trusted keys in keyring...
-> Locally signing key D8AFDDA07A5B6EDFA7D8CCDAD6D055F927843F1C...
==> ERROR: D8AFDDA07A5B6EDFA7D8CCDAD6D055F927843F1C could not be locally signed.
-> Locally signing key DDB867B92AA789C165EEFA799B729B06A680C281...
==> ERROR: DDB867B92AA789C165EEFA799B729B06A680C281 could not be locally signed.
-> Locally signing key 91FFE0700E80619CEB73235CA88E23E377514E00...
==> ERROR: 91FFE0700E80619CEB73235CA88E23E377514E00 could not be locally signed.
-> Locally signing key 0E8B644079F599DFC1DDC3973348882F6AC6A4C2...
==> ERROR: 0E8B644079F599DFC1DDC3973348882F6AC6A4C2 could not be locally signed.
-> Locally signing key AB19265E5D7D20687D303246BA1DFB64FFF979E7...
==> ERROR: AB19265E5D7D20687D303246BA1DFB64FFF979E7 could not be locally signed.
upgrading linux-api-headers...
upgrading iana-etc...
upgrading filesystem...
upgrading glibc...
warning: /etc/locale.gen installed as /etc/locale.gen.pacnew
Generating locales...
en_US.UTF-8... done
Generation complete.
upgrading gcc-libs...
upgrading bash...
upgrading libp11-kit...
upgrading libcap...
upgrading libgpg-error...
upgrading systemd-libs...
upgrading p11-kit...
upgrading ca-certificates-mozilla...
upgrading libutil-linux...
upgrading curl...
upgrading glib2...
upgrading hwids...
upgrading pambase...
upgrading pam...
upgrading kbd...
upgrading pacman-mirrorlist...
warning: /etc/pacman.d/mirrorlist installed as /etc/pacman.d/mirrorlist.pacnew
upgrading sqlite...
installing libxcrypt...
installing file...
upgrading util-linux...
upgrading systemd...
:: Running post-transaction hooks...
( 1/11) Creating system user accounts...
( 2/11) Updating journal message catalog...
( 3/11) Reloading system manager configuration...
Skipped: Current root is not booted.
( 4/11) Updating udev hardware database...
( 5/11) Applying kernel sysctl settings...
Skipped: Current root is not booted.
( 6/11) Creating temporary files...
/usr/lib/tmpfiles.d/journal-nocow.conf:26: Failed to resolve specifier: uninitialized /etc detected, skipping
All rules containing unresolvable specifiers will be skipped.
( 7/11) Reloading device manager configuration...
Skipped: Device manager is not running.
( 8/11) Arming ConditionNeedsUpdate...
( 9/11) Rebuilding certificate stores...
(10/11) Reloading system bus configuration...
Skipped: Current root is not booted.
(11/11) Cleaning up package cache...
What is the diff between them? And how can I have a Dockerfile that works?
Thanks
PS: this is not a space problem (df -h does not show me a "Use%" close to being full)
This seems related to buildkit, as noticed by larsks. /etc/resolv.conf and /etc/hosts are mounted read-only when using buildkit. pacman seems to try to update these files, resulting in the error you see.
As a workaround, you can set the DOCKER_BUILDKIT environment variable from 1 to 0 to disable it. For example:
DOCKER_BUILDKIT=0 docker build .

OpenCV 4.2.0 with python3 and CUDA : Segfault on cv2.VideoCapture()

I encounter a problem with OpenCV that I have for several days now : it segfaults when calling the cv2.VideoCapture() function.
When launching my script (with GDB) :
extract-all_1 | Thread 1 "python3" received signal SIGSEGV, Segmentation fault.
extract-all_1 | 0x00007f83857fe33b in bool pyopencv_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(_object*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, ArgInfo const&) [clone .isra.1286] ()
extract-all_1 | from /usr/lib/python3/dist-packages/cv2/python-3.6/cv2.cpython-36m-x86_64-linux-gnu.so
extract-all_1 | (gdb) quit
When running my script without GDB, the container exits with code 139
I identified the problem occures when calling the "cv2.VideoCapture()" function :
def perform_video_extraction(video_path):
input_movie = cv2.VideoCapture(video_path)
nb_total_frames = int(input_movie.get(cv2.CAP_PROP_FRAME_COUNT))
[...]
Hints :
I process MP4 video files
I've tried compressing my videos that are >30fps to 25fps
I've tried with OpenCV 3.4.9, 4.1.0, 4.1.1, 4.1.2, 4.2.0 and 4.3.0 (pip install)
I've tried compiling OpenCV 4.2.0 and 4.3.0 from source
I've tried each version above successively with CUDA 10.0, 10.1 and 10.2 : each version for each case produces the same error
This segfault is not reproduced when using the CPU (non-cuda) version of OpenCV
Here is my Dockerfile (CUDA 10.2 with OpenCV 4.2.0 built from source) : https://pastebin.com/raw/a42wtcRG
Here is what the cmake summary build returns : https://pastebin.com/raw/SFPUakyL
My config :
Ubuntu 18.04
Nvidia Docker (CUDA 10.2, CUDNN 7, Ubuntu 18.04, devel)
Python 3.6
Have you any recommendation for debugging this problem ?
Thank you
I managed to debug the problem. Due to a stupid encoding issue.
Adding :
ENV LANG C.UTF-8
to my Dockerfile managed to make the container run (my original pastebin mentioned this line but after doublecheck, I didn't have it).
I was able to find out this idea because of this more accurate backtrace from GDB :
root#f42846d26d89:/opencv-4.2.0/build# gdb --args python3 -u /usr/app/scripts/extract.py
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python3...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/python3 -u /usr/app/scripts/extract.py
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[...]
Thread 1 "python3" received signal SIGSEGV, Segmentation fault.
getUnicodeString (str="", obj=<optimized out>) at /opencv-4.2.0/modules/python/src2/pycompat.hpp:69
69 if (PyBytes_Check(bytes))
(gdb) backtrace
#0 0x00007f2959a1433b in getUnicodeString (str="", obj=<optimized out>) at /opencv-4.2.0/modules/python/src2/pycompat.hpp:69
#1 0x00007f2959a1433b in pyopencv_to<std::__cxx11::basic_string<char> >(PyObject*, cv::String&, ArgInfo const&) (obj=<optimized out>, value="", info=...)
at /opencv-4.2.0/modules/python/src2/cv2.cpp:731
#2 0x00007f2959dd6a2d in pyopencv_cv_VideoCapture_VideoCapture(pyopencv_VideoCapture_t*, PyObject*, PyObject*) (self=0x7f2965344190, args=0x7f296307c3c8, kw=0x0)
at /opencv-4.2.0/build/modules/python_bindings_generator/pyopencv_generated_types_content.h:21272
#3 0x0000000000551b81 in ()
#4 0x00000000005aa6ec in _PyObject_FastCallKeywords ()
#5 0x000000000050abb3 in ()
#6 0x000000000050c5b9 in _PyEval_EvalFrameDefault ()
#7 0x0000000000509d48 in ()
#8 0x000000000050aa7d in ()
#9 0x000000000050c5b9 in _PyEval_EvalFrameDefault ()
#10 0x0000000000508245 in ()
#11 0x000000000050b403 in PyEval_EvalCode ()
#12 0x0000000000635222 in ()
#13 0x00000000006352d7 in PyRun_FileExFlags ()
#14 0x0000000000638a8f in PyRun_SimpleFileExFlags ()
#15 0x0000000000639631 in Py_Main ()
#16 0x00000000004b0f40 in main ()
(gdb) list
64 {
65 bool res = false;
66 if (PyUnicode_Check(obj))
67 {
68 PyObject * bytes = PyUnicode_AsUTF8String(obj);
69 if (PyBytes_Check(bytes))
70 {
71 const char * raw = PyBytes_AsString(bytes);
72 if (raw)
73 {
(gdb)
/opencv-4.2.0 being my install path
It seems like my filenames were not in a right encoding format.
Finally, I specify that pip installing the python binding directly works perfectly fine now this modification has been brought.

perl 5.26.2 crashes with SIGSEGV (exit code 139) in ubuntu container

I have a confusing perl behaviour. From time to time (several times a day) it crashes when running inside ubuntu 18.04 kubernetes container with SIGSEGV (exit code 139). A coredump reveals some strange error like below:
Type "apropos word" to search for commands related to "word"...
Reading symbols from /opt/mettools/bin/perl...done.
[New LWP 2218]
[New LWP 1]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `perl /opt/mettools/bin/s4p-server-http.pl -a'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 __GI_getenv (name=0x7f34b8d9b226 "", name#entry=0x7f34b8d9b224 "TZ") at getenv.c:84
84 getenv.c: No such file or directory.
[Current thread is 1 (Thread 0x7f34b79ab700 (LWP 2218))]
(gdb) bt
#0 __GI_getenv (name=0x7f34b8d9b226 "", name#entry=0x7f34b8d9b224 "TZ") at getenv.c:84
#1 0x00007f34b8cba0db in tzset_internal (always=1) at tzset.c:378
#2 __tzset () at tzset.c:552
#3 0x00005650223b41ef in Perl_localtime64_r ()
#4 0x00005650223698c5 in Perl_pp_gmtime ()
#5 0x000056502230c5b6 in Perl_runops_standard ()
#6 0x000056502228586f in Perl_call_sv ()
#7 0x00007f34b9aba93b in S_jmpenv_run () from /opt/mettools/lib/5.26.2/x86_64-linux-thread-multi/auto/threads/threads.so
#8 0x00007f34b9abab9d in S_ithread_run () from /opt/mettools/lib/5.26.2/x86_64-linux-thread-multi/auto/threads/threads.so
#9 0x00007f34b97b86db in start_thread (arg=0x7f34b79ab700) at pthread_create.c:463
#10 0x00007f34b8d0788f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Does anybody have an idea where to look at for that kind of error? The perl script is an API server running in the container. Thanks to kubernetes nature it restarts the container every time the perl crashes (5-6 failures a day), but of course it's annoying to see such a buggy system. :)
The system is:
ubuntu 18.04
perl 5.26.2 (from anaconda conda-forge channel)
base module for the server is HTTP::Server::Simple::CGI 0.52
I don't know if it relates or just a coincidence, but running the same docker container in a similar docker swarm infrastructure helps to increase the life time of the container up to several weeks and sometimes months. Pls share your thoughts!

Resources