Cannot suppress browser logs in Geckodriver - selenium-firefoxdriver

I am running Geckodriver (and Firefox) and apparently Gecko is flooded with an error from FF (see below). I am not using any addons and I don't know why is it there. I wanted to suppress it so that the logs do not contain anything from the browser. I set log level to fatal but it seems that it only affects geckodriver's own logs, but not those from the browser.
I start geckodriver with this command:
./geckodriver.exe --port=4567 --binary="C:\Program Files (x86)\Mozilla Firefox\firefox.exe" --log fatal
Then I create session by manually sending HTTP request POST request to \session:
{
"desiredCapabilities": {
"acceptInsecureCerts": true,
"loggingPrefs": {
"server": "OFF",
"performance": "OFF",
"driver": "OFF",
"browser": "OFF",
"client": "OFF"
},
"browserName": "firefox",
"moz:firefoxOptions": {
"args": []
},
"version": "",
"platform": "ANY"},
"requiredCapabilities": {},
"capabilities": {
"desiredCapabilities": {
"acceptInsecureCerts": true,
"loggingPrefs": {
"server": "OFF",
"performance": "OFF",
"driver": "OFF",
"browser": "OFF",
"client": "OFF"
},
"browserName": "firefox",
"version": "",
"platform": "ANY"
},
"requiredCapabilities": {},
"alwaysMatch": {
"acceptInsecureCerts": true
}
}
}
And this is the output I'm getting within the first few seconds:
1496327277282 addons.manager ERROR startup failed: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIFile.create]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: resource://gre/modules/FileUtils.jsm :: FileUtils_getDir :: line 70" data: no] Stack trace: FileUtils_getDir()#resource://gre/modules/FileUtils.jsm:70 < FileUtils_getFile()#resource://gre/modules/FileUtils.jsm:42 < validateBlocklist()#resource://gre/modules/AddonManager.jsm:671 < startup()#resource://gre/modules/AddonManager.jsm:834 < startup()#resource://gre/modules/AddonManager.jsm:3129 < observe()#resource://gre/components/addonManager.js:65
JavaScript error: resource://gre/modules/AddonManager.jsm, line 1657: NS_ERROR_NOT_INITIALIZED: AddonManager is not initialized
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
...
This line is repeated hundreds of times per second
How to suppress this log or fix the root cause?
EDIT:
After some research I found out that this line is printed to the standard output when I run firefox.exe from command line (without gecko)

I use Eclipse IDE for Java Developers Version: 2019-12 (4.14.0),
Firefox75.0 (64 bit),
testng 7.1.0,
selenium-java 3.141.59
eclipse Console display
LdrLoadDll: Blocking load of 'safemon64.dll' -- see http://www.mozilla.com/en-US/blocklist/
I don't know how to handle it.

Related

How to have Linux wait till my program finishes its SIGTERM action?

How to have Linux wait till my C++ program completes its cleanup routine. The program initially calls function sigaction(2) to register a custom SIGTERM handler. If test the handler by running kill -s TERM $(ps -C a.out -o pid=), it would have no problem. However, in the real shutting down is another case. Sometimes the handler can get its job all done, but sometimes not. Apparently there is a race condition when the machine is shutting down. Does anyone know how to make the system wait a little bit longer so as to avoid the race condition? Thanks.
In the comments you said you use MX Linux version 18.2. It seems to be based on Debian 9, which uses systemd by default, but still has the option to revert to classic SysVinit if desired. The web pages of MX Linux seem to emphasize the UI and do not mention anything special about the init system, so I'll assume it uses systemd too.
With systemd, a mechanism called control groups (cgroups for short) is in play: when systemd starts a service, it will also place its process in a special cgroup. This cgroup is automatically inherited by any process started by the service. When systemd is stopping a service, it will first execute any custom ExecStop actions, if any are defined for the service, wait for TimeoutStopSec, and if there are then any processes left in the service's cgroup, systemd will send them a SIGTERM, wait for another TimeoutStopSec, and then will send a SIGKILL for any left-over processes in the cgroup.
The thing tripping you up is probably the fact that user sessions are also encapsulated in a cgroup: anything you start manually, with e.g. sh /etc/init.d/yourservice start will still count as part of your user session, even if it performs all the actions needed to classically daemonize. And so, when you initiate a shutdown, the first action is to log out any user sessions... which causes your manually-started service to first receive a SIGHUP, then SIGTERM after a short delay, and possibly a SIGKILL after another short delay. Once the user sessions are cleaned up, the rest of the shutdown process will happen.
In order to use init.d scripts successfully with systemd, you'll need to know a few things.
systemd's compatibility mechanism for init.d scripts works by automatically generating a native systemd .service unit file for every init.d script, and then using those unit files just like native systemd services. This causes three requirements you might be unfamiliar with:
your init.d script should have a Linux Standard Base comment block before any non-comment lines in the script that describes the dependencies to any other services. It should look somewhat like this (example from Dovecot IMAP server):
### BEGIN INIT INFO
# Provides: dovecot
# Required-Start: $local_fs $remote_fs $network $syslog $time
# Required-Stop: $local_fs $remote_fs $network $syslog
# Should-Start: postgresql mysql slapd winbind nslcd
# Should-Stop: postgresql mysql slapd winbind nslcd
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Dovecot init script
# Description: Init script for dovecot services
### END INIT INFO
After placing your init.d script, you should run systemctl daemon-reload to trigger the re-run of the systemd-sysv-generator that produces the unit file that will call your script.
After placing the script as /etc/init.d/yourservice and running systemctl daemon-reload, you should start the service using either systemctl start yourservice or service yourservice start. Only these methods cause systemd to place your service to its own control group, which will be important for the orderly shutdown your service needs. Running sh /etc/init.d/yourservice start will not do that.
You can use systemctl cat yourservice to view the resulting auto-generated yourservice.service unit file.
It might be a better idea to just write a native systemd service unit file for your service. You can find the distribution's standard unit files at /lib/systemd/system/ directory; you can use them as examples, but you should place your custom unit file into /etc/systemd/system instead, so your unit file won't be overridden by any package updates.

Get core dump from CGI process with lighttpd

Using lighttpd (version 1.4.35) on Linux: How can I get a core dump from a CGI program that exits with SIGABORT (or SIGSEGV for that matter) instead of lighttpd trapping the signal?
Are there lighttpd configuration options to prevent lighttpd or mod_cgi from trapping the signals?
I can modify & recompile the CGI program to reset the signal handler of interest, but I would rather do this with modifying the code in question.
EDIT: Here's the message I see from lighttpd:
(mod_cgi.c.1312) cleaning up CGI: process died with signal 6
mod_cgi.c.1050: aborted

GHCi breaking the running application

I tried to run the sample tcp server application in http://www.haskell.org/haskellwiki/Simple_Servers this address in my GHCi for Windows. When i run 'main' function it works and client can connect. But i want to break it and hit CTRL-C but it doesn't break. How can i break the running application in GHCi?

Apache httpd terminates on interrupt/breakpoint

I try to use "valgrind --vgdb=yes httpd -X" to debug a service running via httpd, and monitor memory leaks using "monitor leak_check full reachable increased" after each request. The problem is that I cannot interrupt httpd reliably in order to run the "monitor" command in gdb - when I press Ctrl-C in valgrind/httpd terminal, it usually terminates, same when I send kill -INT. I tried different "handle SIGINT/SIGTERM nopass/pass" but with no luck.
Also often, when I just add breakpoints and pause httpd in Eclipse CDT/gdb debugger, httpd terminates, too.
So is it possible to interrupt httpd without making it exit in 90% cases?

How to debug a remote linux binary?

Here is the situation:
I've got a linux binary that is crashing. No log files, trace files, etc. I need to be able to attach a debugger to it (I have the source locally) and track down the error.
Whats the easiest, best way to approach this problem?
Remote debugging is rather straightforward: on the target platform, launch the application with GDBserver, while specifying the host and port for listening to an incoming TCP connection:
gdbserver HOST:PORT PROG [ARGS ...]
On the development workstation, launch the cross-target GDB:
powerpc-7450-linux-gnu-gdb PROG
Be sure to specify the non-stripped executable. At the GDB console, type:
target remote HOST:PORT
break main
continue
Remote cross-target debugging with GDB and GDBserver
It looks like gdb supports remote debugging.
I've never used it but http://davis.lbl.gov/Manuals/GDB/gdb_17.html looks like a start.
Basically you run the program under gdbserver on the target machine, and gdb connects (over TCP or serial) to the gdbserver.

Resources