How can I reproduce “Leap Second Bug” on my linux system - linux

I'm using java application on linux system(Redhat 6.6). Some times this application charged CPU 100%.
This is proc strace.
[chgminer#perpscm CE]$ strace -p 18182
...
sched_yield() = 0
sched_yield() = 0
futex(0x7ff5ec021e54, FUTEX_WAIT_BITSET_PRIVATE, 1, {16502241, 759149277}, ffffffff) = -1 ETIMEDOUT (Connection timed out)
futex(0x7ff5ec021e28, FUTEX_WAKE_PRIVATE, 1) = 0
...
strace printed "futex .. ETIMEOUT". So I guess "Leap Second Bug".
And I want to fix this problem.
But the problem machine can not access some reason.
So I must reproduce this situation on other system(linux).
How can I reproduce this situation?
System Infomation
OS : Linux 2.6.32-504.el6.x86_64 (amd64)
Red Hat Enterprise Linux Server release 6.6 (Santiago)

Related

conflict madvise system calls on Linux

I have a program calling madvise [1] system call to give OS hint about how the memory will be accessed.
When randomly accessing an mmapped file, some conflict advise is given to OS:
197 mmap(NULL, 125554026, PROT_READ, MAP_PRIVATE, 6, 0) = 0x7f023f242000
198 madvise(0x7f023f242000, 125554026, MADV_RANDOM) = 0
199 madvise(0x7f023f242000, 6, MADV_WILLNEED) = 0
200 madvise(0x7f02469fe000, 3434, MADV_WILLNEED) = 0
.....
204 madvise(0x7f023f242000, 928, MADV_WILLNEED) = 0
205 madvise(0x7f023f242000, 125553424, MADV_WILLNEED) = 0
As you can see:
#198 system call madvise tells OS to randomly access this file
but #205 system call madvise tells OS that almost entire file is WILLNEED (asking for prefetch)
I am not sure what the expected behavior is for Linux kernel in this case.
I have two different deployment environments:
one is CentOS 7.6 with Linux Kernel 3.10.0
and the other is Ubuntu 20.04 with Linux Kernel 5.4.0
And I observed different behaviors:
For CentOS 7.6, the entire file is pre-loaded to page cache (#205 system call wins)
while for Ubuntu 20.04, only the randomly accessed parts are loaded to page cache (#198 system call wins).
I don't know where to find such information about this behavior when two madvise system call give conflict hints. Could some one shed some light on this? Thanks.
References
[1] https://linux.die.net/man/2/madvise

"Microsoft Windows 10 Enterprise 2016 LTSB 10.0.14393 Version 1607" fails on boot in qemu/kvm (proxmox)

I have played with different versions of windows 10 inside qemu/kvm (proxmox) and all of them works fine except: "Microsoft Windows 10 Enterprise 2016 LTSB 10.0.14393 Version 1607".
I don't think that the problem is connected with proxmox itself. As I know proxmox is stable and reliable system that use qemu/kvm under the hood. So lets think more about qemu/kvm. However my proxmox versions below.
root#home:~# pveversion -v
proxmox-ve: 5.3-1 (running kernel: 4.15.18-10-pve)
pve-manager: 5.3-8 (running version: 5.3-8/2929af8e)
pve-kernel-4.15: 5.3-1
pve-kernel-4.15.18-10-pve: 4.15.18-32
corosync: 2.4.4-pve1
criu: 2.11.1-1~bpo90
glusterfs-client: 3.8.8-1
ksm-control-daemon: 1.2-2
libjs-extjs: 6.0.1-2
libpve-access-control: 5.1-3
libpve-apiclient-perl: 2.0-5
libpve-common-perl: 5.0-44
libpve-guest-common-perl: 2.0-19
libpve-http-server-perl: 2.0-11
libpve-storage-perl: 5.0-36
libqb0: 1.0.3-1~bpo9
lvm2: 2.02.168-pve6
lxc-pve: 3.1.0-2
lxcfs: 3.0.2-2
novnc-pve: 1.0.0-2
proxmox-widget-toolkit: 1.0-22
pve-cluster: 5.0-33
pve-container: 2.0-33
pve-docs: 5.3-1
pve-edk2-firmware: 1.20181023-1
pve-firewall: 3.0-17
pve-firmware: 2.0-6
pve-ha-manager: 2.0-6
pve-i18n: 1.0-9
pve-libspice-server1: 0.14.1-1
pve-qemu-kvm: 2.12.1-1
pve-xtermjs: 3.10.1-1
qemu-server: 5.0-45
smartmontools: 6.5+svn4324-1
spiceterm: 3.0-5
vncterm: 1.5-3
zfsutils-linux: 0.7.12-pve1~bpo1
In any case I have not found any similar thread on proxmox forum. That's why I post my problem here.
This is clean original msdn iso from microsoft with confirmed hash sums(installed more then 10 times).
Steps to reproduce:
Create VM with next configuration
root#home:~# cat /etc/pve/qemu-server/102.conf
bios: ovmf
boot: dcn
bootdisk: scsi0
cores: 8
cpu: host
efidisk0: local-lvm:vm-102-disk-0,size=4M
ide2: iso-backs:iso/MS DaRT 10 Eng x86 x64.iso,media=cdrom,size=600320K
machine: q35
memory: 8192
name: win10-test
net0: virtio=C2:25:D9:DD:F2:4F,bridge=vmbr0
numa: 1
ostype: win10
scsi0: local-lvm:vm-102-disk-1,size=100G
scsi1: external:vm-102-disk-0,size=100G
scsihw: virtio-scsi-pci
smbios1: uuid=9d455cbf-1fa2-495f-928d-3935ec39c245
sockets: 1
usb0: host=1c4f:0002
usb1: host=09da:9090
vmgenid: 40cd47b6-35c4-47ab-8f9e-ed2acb618fcc
Install latest virtio drivers (scsi, netkvm, baloon, qemu-fwcfg)
Accept disk auto-partitioning (4 partitions will be created for this iso)
Wait installations end and reboot the system
Boot will stuck at proxmox logo
However, I can always boot from live cd (MS DaRT), to do that I need to manually choose harddisk from "Use a device" menu.
Once it load successfully there is a chance it will boot again an indefinite number of times. I can't figure out the reason of such behavior.
I have tried to avoid this problem by installing grub. But nothing has changed - I am still able to load system through live cd and always have a random chance to stuck at default load process.
Event Viewer errors(repeatable):
Distributed COM Event_id: 10016
Eventlog Event_id: 1101
Kernel-Power Event_id: 41
Eventlog Event_id: 6008
Kernel-Power Event_id: 13

Failure running Overtone and SuperCollider

I can't get overtone to work with supercollider server, I'm following the getting started guide at https://github.com/overtone/overtone/wiki/Getting-Started, I've got Jack audio server running through qjackctl, then I ran SuperCollider with scsynth -u 8888 which produced the following output:
Found 12 LADSPA plugins
JackDriver: client name is 'SuperCollider'
SC_AudioDriver: sample rate = 48000.000000, driver's block size = 1024
SuperCollider 3 server ready.
Zeroconf: registered service 'SuperCollider'
then in the clojure repl I connect to SC server:
(connect-external-server 8888)
then when I run (definst foo [] (saw 220))
I get the following error:
CompilerException java.util.concurrent.TimeoutException: deref! timeout
error. Dereference took longer than 5000 ms whilst blocking until the
following node has completed loading: #<synth-group[loading]: Inst foo
Container 41>, compiling:(form-init1483192646581877285.clj:131:7)
and scsynth outputs FAILURE IN SERVER /g_new Group 31 not found
also if I try (demo (sin-osc)) I get the error FAILURE IN SERVER /s_new Group 7 not found
although if I run using sclang:
s.boot;
{ SinOsc.ar(440, 0, 0.2) }.play;
it does produce a sound.
I'm running Manjaro Linux using the Linux 4.9.27 real time Manjaro kernel
and an HDA Intel PCH sound card.

How can I debug this User Space application crash?

I'm running a Qt5.4.0 application on my embedded Linux system (TI AM335x based) and it's stopping to run and I'm having a hard time debugging this. This is a QtWebKit QML example (youtubeview) but other QtWebKit examples are preforming the same for me so it's something WebKit based on my system.
When I run the application, it runs for a second or so, then ends with no messages. There is nothing reported to the syslog or dmesg either. When I kick it off with strace I can see this futex message:
futex(0x2d990, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x2d9ac, FUTEX_WAIT_PRIVATE, 7, NULL <unfinished ...>
+++ exited with 1 +++
Then it stops. Not very helpful... My next though was to debug this with GDB, however GDB crashes when I try to run this:
-sh-4.2# gdb youtubeview
GNU gdb (GDB) 7.5
Copyright (C) 2012 Free Software Foundation, Inc.
...
(gdb) run
Starting program: /usr/share/qt5/examples/webkitqml/youtubeview/youtubeview
/home/mike/ulf_qt_450/ulf/build-ulf/out/work/armv7ahf-vfp-neon-linux-gnueabihf/gdb/7.5-r0.0/gdb-7.5/gdb/utils.c:1081: internal-error: virtual memory exhausted: can't allocate 64652911 bytes.
A problem internal to GDB has been detected,
This issue occurs even if I set a break point at main first, just as soon as it starts running it will get stuck and run out of memory.
Are there other tools or techniques that can be used here to help isolate the issue?
Perhaps arguments to GDB to limit memory use or give some more information about why this Qt program made it crash?
Perhaps some FDs or system variables I could use to figure out why the FUTEX is being held and failing?
I'm not sure where to take this problem right now.
The Qt code itself is pretty simple, and I don't anticipate any issues in here:
#include <QGuiApplication>
#include <QQuickView>
int main(int argc, char* argv[])
{
QGuiApplication app(argc,argv);
QQuickView view;
view.setSource(QUrl("qrc:///" QWEBKIT_EXAMPLE_NAME ".qml"));
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.show();
return app.exec();
return 0;
}
Running gdb on the device, especially with a huge library such as WebKit, is bound to get you out of memory errors.
Instead, run gdbserver on the device, and connect to it via gdb running on the host machine, using the toolchain's cross-gdb for that. In that scenario, the gdb on the host loads all the debug information, while the gdbserver on the device needs almost no memory.
It is even possible to have the separate debug information available on the host and stripped libraries on the device.
Please note that parts of WebKit are always built in release mode, even if the rest of Qt was built in debug mode, if you are going to debug into WebKit you might want to change that in the build system.
Here is a minimal example:
Device:
# gdbserver 192.168.1.2:12345 myapp
Process myapp created; pid = 989
Listening on port 12345
Host:
# arm-none-linux-gnueabi-gdb myapp
GNU gdb (Sourcery G++ Lite 2009q1-203) 6.8.50.20081022-cvs
(gdb) set solib-absolute-prefix /opt/targetroot
(gdb) target remote 192.168.1.42:12345
Remote debugging using 192.168.1.42:12345
(gdb) start
The "remote" target does not support "run". Try "help target" or "continue".
(gdb) break main
Breakpoint 1 at 0x1ab9c: file myapp/main.cpp, line 12.
(gdb) cont
Continuing.
Breakpoint 1, main (argc=1, argv=0xbecfedb4) at myapp/main.cpp:12
12 QApplication app(argc, argv, QApplication::GuiServer);
And you are right that it looks like a problem in QtWebKit itself, not in your application. Good luck!

Using Linux virtual mouse driver

I am trying to implement a virtual mouse driver according to the Essential Linux device Drivers book. There is a user space application, which generates coordinates as well as a kernel module.
See: Virtual mouse driver and userspace application code and also a step by step on how to use this driver.
1.) I compile the code of the user space application and driver.
2.) Next i checked dmesg output and have,
input: Unspecified device as /class/input/input32
Virtual Mouse Driver Initialized
3.) The sysfs node was created properly during initialization (found in /sys/devices/platform/vms/coordinates)
4.) I know that the virtual mouse driver (input32 ) is linked to event5 by checking the following:
$ cat /proc/bus/input/devices
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name=""
P: Phys=
S: Sysfs=/devices/virtual/input/input32
U: Uniq=
H: Handlers=event5
B: EV=5
B: REL=3
5.) Next i attach a GPM server to the event interface: gpm -m /dev/input/event5 -t evdev
6.) Run the user space application to generate random coordinates for virtual mouse and observe generated coordinates using od -x /dev/input/event5.
And nothing happens. Why?
Also here author mentioned that gdm should be stopped, using /etc/init.d/gdm stop, but i get "no such service" when stopping gdm.
Here is my complete script for building and runing virtual mouse:
make -C /usr/src/kernel/2.6.35.6-45.fc14.i686/ SUBDIRS=$PWD modules
gcc -o app_userspace app_userspace.c
insmod app.ko
gpm -m /dev/input-event5 -t evdev
./app_userspace
Makefile:
obj-m+=app.o
Kernel version: 2.6.35.6
As i said before i can recieve the result through od, but i received it through your program
echo 9 19 > /sys/devices/platform/virmouse/vmevent
gives:
time 1368284298.207654 type 2 code 0 value 9
time 1368284298.207657 type 2 code 1 value 19
time 1368284298.207662 type 0 code 0 value 0
So now the question is: what is wrong with X11? I would like to stress, that i tried this code under two different distributions Ubuntu 11.04 and Fedora 14.
Maybe this will help: in Xorg.0.log i see the following:
[ 21.022] (II) No input driver/identifier specified (ignoring)
[ 272.987] (II) config/udev: Adding input device (/dev/input/event5)
[ 272.987] (II) No input driver/identifier specified (ignoring)
[ 666.521] (II) config/udev: Adding input device (/dev/input/event5)
[ 666.521] (II) No input driver/identifier specified (ignoring)
I spent a huge amount of time, resolving this issue, and i would like to help other people, who run in this problem. I think some outer X11 features interfered my module work. After disabling GDM it now works fine (runlevel 3). Working code you can find here http://fred-zone.blogspot.ru/2010/01/mouse-linux-kernel-driver.html working distro ubuntu 11.04 (gdm disabled)
Try replacing the below lines of code in the input device driver
set_bit(EV_REL, vms_input_dev->evbit);
set_bit(REL_X, vms_input_dev->relbit);
set_bit(REL_Y, vms_input_dev->relbit);
with
vms_input_dev->name = "Virtual Mouse";
vms_input_dev->phys = "vmd/input0"; // "vmd" is the driver's name
vms_input_dev->id.bustype = BUS_VIRTUAL;
vms_input_dev->id.vendor = 0x0000;
vms_input_dev->id.product = 0x0000;
vms_input_dev->id.version = 0x0000;
vms_input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
vms_input_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE);
vms_input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
vms_input_dev->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_SIDE) | BIT_MASK(BTN_EXTRA);
vms_input_dev->relbit[0] |= BIT_MASK(REL_WHEEL);
It worked for me on ubuntu 12.04

Resources