[Gambas-user] gbx3, how and where to handle POLLHUP event ?

Benoît Minisini g4mba5 at gmail.com
Sat Mar 21 13:58:04 CET 2020


Le 21/03/2020 à 09:34, Peter Bauer a écrit :
> Hello,
> In which source file does gbx handle poll() callbacks to watch open files ?
> 
> High CPU load and fast repeating output from strace attached to gbx3 
> process:
> poll([ {fd= 6, events = POLLIN}, {fd= 7, events = POLLIN}, {fd= 8, 
> events = POLLIN |POLLPRI}, {fd=13, events=POLLIN}], 4, 989) = 1 
> ([{fd=13, revents=POLLHUP}])
> 
> Gambas example:
> https://gambas.one/gambasfarm/?id=761&action=search
> (must be run from a terminal to show the issue,issue not visible in 
> gambas IDE !)
> 
> I would like to look if it is possible to handle an incoming pipe when 
> the sender
> process has ended. In this case the pipe should no longer be watched and 
> just be closed and/or an error should be thrown. I found a C source code 
> example for this:
> https://stackoverflow.com/questions/5857461/how-to-use-the-poll-c-function-to-watch-named-pipes-in-linux/44126952#44126952
> 
> [System]
> Gambas=3.14.90 a59dfb169 (master)
> OperatingSystem=Linux
> Kernel=4.15.0-88-generic
> Architecture=x86_64
> Distribution=Ubuntu 18.04.4 LTS
> Desktop=MATE
> Theme=Fusion
> Language=en_US.UTF-8
> Memory=15868M
> 
> [Libraries]
> Cairo=libcairo.so.2.11510.0
> Curl=libcurl.so.4.5.0
> DBus=libdbus-1.so.3.19.4
> GStreamer=libgstreamer-1.0.so.0.1405.0
> GTK+2=libgtk-x11-2.0.so.0.2400.32
> GTK+3=libgtk-3.so.0.2200.30
> OpenGL=libGL.so.1.0.0
> Poppler=libpoppler.so.57.0.0
> Poppler=libpoppler.so.73.0.0
> QT4=libQtCore.so.4.8.7
> QT5=libQt5Core.so.5.9.5
> SDL=libSDL-1.2.so.0.11.4
> SQLite=libsqlite3.so.0.8.6
> 
> [Environment]
> COMPIZ_CONFIG_PROFILE=mate
> DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-xW4AH1pxYD,guid=78dee8a13ae9ae16412773225e6b56da
> DESKTOP_SESSION=mate
> DISPLAY=:0
> GB_GUI=gb.qt5
> GDMSESSION=mate
> GDM_LANG=en
> GIO_LAUNCHED_DESKTOP_FILE=<home>/Schreibtisch/Gambas3.desktop
> GIO_LAUNCHED_DESKTOP_FILE_PID=7578
> GTK_OVERLAY_SCROLLING=0
> HOME=<home>
> INSIDE_CAJA_PYTHON=
> JAVA_HOME=/usr/lib/jvm/java-8-oracle
> LANG=en_US.UTF-8
> LANGUAGE=en_US.UTF-8
> LC_ADDRESS=de_AT.UTF-8
> LC_ALL=en_US.UTF-8
> LC_IDENTIFICATION=de_AT.UTF-8
> LC_MEASUREMENT=de_AT.UTF-8
> LC_MONETARY=de_AT.UTF-8
> LC_NAME=de_AT.UTF-8
> LC_NUMERIC=de_AT.UTF-8
> LC_PAPER=de_AT.UTF-8
> LC_TELEPHONE=de_AT.UTF-8
> LC_TIME=de_AT.UTF-8
> LOGNAME=<user>
> MATE_DESKTOP_SESSION_ID=this-is-deprecated
> PAPERSIZE=a4
> PATH=<home>/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/lib/node_modules/:<home>/rakudo/rakudo-2020.01/bin/:<home>/bin:<home>/rakudo/rakudo-2020.01/share/perl6/site/bin:<home>/rakudo/rakudo-2020.01/
> PWD=<home>
> QT_AUTO_SCREEN_SCALE_FACTOR=0
> QT_LOGGING_RULES=*.debug=false
> QT_SCALE_FACTOR=1
> SESSION_MANAGER=local/<hostname>:@/tmp/.ICE-unix/5255,unix/<hostname>:/tmp/.ICE-unix/5255
> SHELL=/bin/bash
> SHLVL=0
> SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
> TZ=:/etc/localtime
> USER=<user>
> XAUTHORITY=<home>/.Xauthority
> XDG_CONFIG_DIRS=/etc/xdg/xdg-mate:/etc/xdg
> XDG_CURRENT_DESKTOP=MATE
> XDG_DATA_DIRS=/usr/share/mate:/usr/local/share:/usr/share:/var/lib/snapd/desktop
> XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/<user>
> XDG_RUNTIME_DIR=/run/user/1000
> XDG_SEAT=seat0
> XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
> XDG_SESSION_DESKTOP=mate
> XDG_SESSION_ID=c2
> XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
> XDG_SESSION_TYPE=x11
> XDG_VTNR=7
> 
> 
> Best Regards,
> Peter Bauer
> 
> 
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> 

I will look at it.

Two remarks first:

- Why did you put the gbx3 executable inside your project???

- The event loop depends on the GUI component, so the behaviour is 
different between a command-line application, a QT application and a 
GTK+ application.

I wrote the interpreter event loop, but not the QT or GTK+ one, so maybe 
the problem comes from that difference.

Regards,

-- 
Benoît Minisini


More information about the User mailing list