valgrind detect fd leak of its own - valgrind

I am using valgrind to detect memory leak. However, the valgrind detect fd leak in the program. like the following.
==00:00:00:40.685 31162== FILE DESCRIPTORS: 4 open at exit.
==00:00:00:40.685 31162== Open file descriptor 3: client.valgrind(this is open by valgrind)
==00:00:00:40.685 31162== <inherited from parent>
==00:00:00:40.685 31162==
==00:00:00:40.685 31162== Open file descriptor 2: /dev/pts/19
==00:00:00:40.685 31162== <inherited from parent>
==00:00:00:40.685 31162==
==00:00:00:40.685 31162== Open file descriptor 1: /dev/pts/19
==00:00:00:40.685 31162== <inherited from parent>
==00:00:00:40.685 31162==
==00:00:00:40.685 31162== Open file descriptor 0: /dev/pts/19
==00:00:00:40.685 31162== <inherited from parent>
But the client.valgrind is the log file of valgrind and 0 , 1, 2 is standard output input and err file fd. I don't open them apparantly. I feel confused.

I don't think this should be considered a problem, it's completely normal that valgrind informs you about them. Why should it handle the first 3 fd's in a different way? If you close them (close(0); close(1); close(2);) before returning from main, these printouts will disappear, but it's clearly unneccessary.

Related

RobotFramework seleniumlibrary open headless browser in network namespace

I need to use network namespaces in my setup, and it is working just fine.
However, when it comes to testing via seleniumLibrary to open a browser and test webinterface, i can't seem to get it to work with network namespaces.
I can manually run firefox in namespace by running firefox in the namespace, that has access the the network the namespace is assigned.
How do i do this in RobotFramework with seleniumLibrary?
I have this atm:
*** Settings ***
Documentation Test browser access in netns
Library OperatingSystem
Library SeleniumLibrary
Force Tags test_123
*** Test Cases ***
Test Browser In Netns
Open Browser 192.168.0.100 browser=ff
Close Browser
Running this produces the error: \
WebDriverException: Message: Service geckodriver unexpectedly exited. Status code was: 69
Traceback (most recent call last):
File "/home/mci/.local/lib/python3.8/site-packages/SeleniumLibrary/__init__.py", line 492, in run_keyword
return DynamicCore.run_keyword(self, name, args, kwargs)
File "/home/mci/.local/lib/python3.8/site-packages/robotlibcore.py", line 103, in run_keyword
return self.keywords[name](*args, **(kwargs or {}))
File "/home/mci/.local/lib/python3.8/site-packages/SeleniumLibrary/keywords/browsermanagement.py", line 293, in open_browser
return self._make_new_browser(
File "/home/mci/.local/lib/python3.8/site-packages/SeleniumLibrary/keywords/browsermanagement.py", line 324, in _make_new_browser
driver = self._make_driver(
File "/home/mci/.local/lib/python3.8/site-packages/SeleniumLibrary/keywords/browsermanagement.py", line 716, in _make_driver
driver = self._webdriver_creator.create_driver(
File "/home/mci/.local/lib/python3.8/site-packages/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py", line 83, in create_driver
return creation_method(
File "/home/mci/.local/lib/python3.8/site-packages/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py", line 199, in create_firefox
return webdriver.Firefox(
File "/home/mci/.local/lib/python3.8/site-packages/selenium/webdriver/firefox/webdriver.py", line 164, in __init__
self.service.start()
File "/home/mci/.local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 98, in start
self.assert_process_still_running()
File "/home/mci/.local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 109, in assert_process_still_running
raise WebDriverException(
Running this outside network namespace produces no errors, and goes through 100% pass.
Loopback is not automatically added and up'ed when creating netns.
This needs to be added with ip netns exec net-$name ip link set dev lo up.
GeckoDriver will try to bind itself to a random port on 127.0.0.1, so without lo being up, it will naturally fail.

Use custom driver for all new USB devices with same VID/PID

In order to use my USB HID complient device with LabView, I had to create a custom USB driver. That works fine, except when I connect a new device (same VID&PID, different GUID) windows automaticly uses the standard hid.dll driver instead of my custom driver. Therefor the new device doesn't work with LabView until I manualy change the driver. Since this should be used in an semi-automated process, this manual driver change is not feasable.
Is there a way to tell windows to use my custom driver, whenever a device with the same VID and PID is connected? Or am I doing something else wrong?
edit:
Setupapi.app.log file after installing driver trough Driver Wizard 5.3:
>>> [Build Driver List - USB\VID_0483&PID_1208&MI_01\8&35506E0F&1&0001]
>>> Section start 2018/03/27 12:52:34.409
cmd: "C:\Program Files (x86)\IVI Foundation\VISA\WinNT\NIvisa\DriverWizardInstallInf64.exe" C:\Users\LOCALA~1\AppData\Local\Temp\LVTEMP~1.TMP
cpy: Policy is set to make all digital signatures equal.
<<< Section end 2018/03/27 12:52:34.413
<<< [Exit status: SUCCESS]
>>> [Build Driver List - USB\VID_0483&PID_1208&MI_01\8&35506E0F&1&0001]
>>> Section start 2018/03/27 12:52:34.413
cmd: "C:\Program Files (x86)\IVI Foundation\VISA\WinNT\NIvisa\DriverWizardInstallInf64.exe" C:\Users\LOCALA~1\AppData\Local\Temp\LVTEMP~1.TMP
cpy: Policy is set to make all digital signatures equal.
! sig: Verifying file against specific (valid) catalog failed! (0x00000057)
! sig: Error 87: The parameter is incorrect.
! sig: Verifying file against specific Authenticode(tm) catalog failed! (0x80092003)
! sig: Error 0x80092003: An error occurred while reading or writing to a file.
<<< Section end 2018/03/27 12:52:34.421
<<< [Exit status: SUCCESS]
>>> [DIF_SELECTBESTCOMPATDRV - USB\VID_0483&PID_1208&MI_01\8&35506E0F&1&0001]
>>> Section start 2018/03/27 12:52:34.422
cmd: "C:\Program Files (x86)\IVI Foundation\VISA\WinNT\NIvisa\DriverWizardInstallInf64.exe" C:\Users\LOCALA~1\AppData\Local\Temp\LVTEMP~1.TMP
<<< Section end 2018/03/27 12:52:34.423
<<< [Exit status: SUCCESS]
.inf file created by Driver Wizard 5.3:
;===========================================================================
; This file was generated using:
; NI-VISA Driver Development Wizard version 5.3
;===========================================================================
;
; This file is for use with Windows 8/7/Vista. This will not work on Windows
; XP. This Windows Setup Information File contains the information
; NI-VISA needs in order to access your instrument. Do not modify the
; contents of this file unless you are sure about what you are doing.
;
;===========================================================================
;
; Windows Vista/7 Installation:
; To apply the contents of this file to a system's settings, right-click
; this file and choose "Install". If the device was plugged in before this
; file is installed, the device will need to be removed from the "Unknown
; Devices" class in the Windows Device Manager.
;
;===========================================================================
;
; Windows 8 Installation:
; To apply the contents of this file to a system's settings, a catalog file
; must be generated and signed using either a personal certificate or a
; certificate obtained from a Certificate Authority (CA). For detailed
; instructions on how to install your INF on Windows 8, visit
; http://ni.com/info and enter the Info Code INFWin8.
;
;===========================================================================
;
; Removal:
; At installation, Windows copies the file into the %SystemRoot%\inf
; directory using the alternate filename oem##.inf. You may have
; to search all the files to find the one from which this is copied.
; Remove that file and its associated .pnf file (if it exists) from
; %SystemRoot%\inf. Either reboot the computer, or perform a
; "Scan for hardware changes" from the Windows Device Manager.
;
;===========================================================================
[Version]
Signature=$WINDOWS NT$
Class=visaUsbDevice
ClassGUID={A3330EDF-239D-4206-833B-1D58952613D5}
Provider=%Vendor0%
DriverVer=03/26/2018,1.0
CatalogFile=JumpSensor.cat
;===========================================================================
; Default Installer
;===========================================================================
[DefaultInstall]
CopyINF=JumpSensor.inf
[DestinationDirs]
[SourceDisksNames]
[SourceDisksFiles]
;===========================================================================
; Class Installer
;===========================================================================
[ClassInstall32]
AddReg=AddClass_AddReg
[AddClass_AddReg]
HKR,,,0,%DeviceClassString%
HKR,,Icon,,"-20"
;===========================================================================
[Manufacturer]
%Vendor1%=USBList,NTamd64
[USBList]
%USB\VID_0483&PID_1208&MI_00.DeviceDesc%=WinUsb_Inst, USB\VID_0483&PID_1208&MI_00
%USB\VID_0483&PID_1208&MI_01.DeviceDesc%=WinUsb_Inst, USB\VID_0483&PID_1208&MI_01
[USBList.NTamd64]
%USB\VID_0483&PID_1208&MI_00.DeviceDesc%=WinUsb_Inst, USB\VID_0483&PID_1208&MI_00
%USB\VID_0483&PID_1208&MI_01.DeviceDesc%=WinUsb_Inst, USB\VID_0483&PID_1208&MI_01
[PreCopySection]
HKR,,NoSetupUI,,1
[WinUsb_Inst]
Include = winusb.inf
Needs = WINUSB.NT
[WinUsb_Inst.hw]
AddReg=WinUsb_Inst_HW_AddReg
[WinUsb_Inst.Services]
Addservice = WinUsb, 0x00000002, WinUsb_AddService
[WinUsb_AddService]
DisplayName = %WinUsb_Service_DisplayName%
ServiceType = %SERVICE_KERNEL_DRIVER%
StartType = %SERVICE_DEMAND_START%
ErrorControl = %SERVICE_ERROR_NORMAL%
ServiceBinary = %12%\WinUSB.sys
[WinUsb_Inst_HW_AddReg]
HKR,,DeviceInterfaceGUIDs, 0x10000,"{761ED34A-CCFA-416b-94BB-33486DB1F5D5}"
[Strings]
Vendor0="STMicroelectronics"
Vendor1="STMicroelectronics"
USB\VID_0483&PID_1208&MI_00.DeviceDesc="JUMP Sensor"
USB\VID_0483&PID_1208&MI_01.DeviceDesc="JUMP Sensor"
DeviceClassString="NI-VISA USB Devices"
WinUsb_Service_DisplayName="WinUSB Driver"
SERVICE_BOOT_START = 0x0
SERVICE_SYSTEM_START = 0x1
SERVICE_AUTO_START = 0x2
SERVICE_DEMAND_START = 0x3
SERVICE_DISABLED = 0x4
SERVICE_KERNEL_DRIVER = 0x1
SERVICE_ERROR_IGNORE = 0x0
SERVICE_ERROR_NORMAL = 0x1
SERVICE_ERROR_SEVERE = 0x2
SERVICE_ERROR_CRITICAL = 0x3

Tensorflow could not initialize the libcurl library on Mac OS

I have build up the WebAPP of this Project on Mac OS using conda and tensorflow v0.12.1. It work so well still I try to train, tensorflow show this error message:
W tensorflow/core/platform/cloud/google_auth_provider.cc:151] All
attempts to get a Google authentication bearer token failed, returning
an empty token. Retrieving token from files failed with "Failed
precondition: Could not initialize the libcurl library. Please make
sure that libcurl is installed in the OS or statically linked to the
TensorFlow binary.". Retrieving token from GCE failed with "Failed
precondition: Could not initialize the libcurl library. Please make
sure that libcurl is installed in the OS or statically linked to the
TensorFlow binary.".
Logs:
2018-04-03 09:33:49,154 - candysorter.views.api - INFO - === Start training: id=9120093671565748, session=20180403_093211_9120093671565748 ===
2018-04-03 09:33:49,154 - candysorter.views.api - INFO - Creating labels file: job_id=candy_sorter_20180403_093211_9120093671565748
2018-04-03 09:33:49,184 - candysorter.views.api - ERROR - Unexpected error.
Traceback (most recent call last):
File "/Users/wubinbin/anaconda3/envs/candy/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/wubinbin/anaconda3/envs/candy/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/wubinbin/Developer/FindYourCandy/webapp/candysorter/views/api.py", line 101, in wrapper
return f(*args, **kwargs)
File "/Users/wubinbin/Developer/FindYourCandy/webapp/candysorter/views/api.py", line 337, in train
candy_trainer.create_labels_file(job_id, labels)
File "/Users/wubinbin/Developer/FindYourCandy/webapp/candysorter/models/images/train.py", line 76, in create_labels_file
f.write(json.dumps(labels, separators=(',', ':')))
File "/Users/wubinbin/anaconda3/envs/candy/lib/python2.7/site-packages/tensorflow/python/lib/io/file_io.py", line 150, in __exit__
self.close()
File "/Users/wubinbin/anaconda3/envs/candy/lib/python2.7/site-packages/tensorflow/python/lib/io/file_io.py", line 182, in close
pywrap_tensorflow.Set_TF_Status_from_Status(status, ret_status)
File "/Users/wubinbin/anaconda3/envs/candy/lib/python2.7/contextlib.py", line 24, in __exit__
self.gen.next()
File "/Users/wubinbin/anaconda3/envs/candy/lib/python2.7/site-packages/tensorflow/python/framework/errors_impl.py", line 469, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
FailedPreconditionError: Could not initialize the libcurl library. Please make sure that libcurl is installed in the OS or statically linked to the TensorFlow binary.
I use TF1.7.0 instead of TF0.12.1, and fix this problem. But I still don't know what happen in TF0.12.1.

Can I mmap to file in JVM?

I want to mmap to file, i.e., without MAP_ANON flag.
So I modified mmap calls in os_linux.cpp, and then JVM failed with SIGSEGV.
How can I mmap to a particular file or block device??

strange behaviour of VB.net exe - vs2005

Ran ProcMon and then ran my vb.net exe.
Saw steps that I am not calling explictly
an example from the PML file is
Thread : 4248
class : File System
Operation : CreateFile
Result: SUCCESS
Path : C:\Documents and Settings\Admin
Desired Access: Read Data/List Directory, Synchronize
Disposition: Open
Options: Directory, Synchronous IO Non-Alert, Open For Backup
Attributes: n/a
ShareMode: Read, Write, Delete
AllocationSize: n/a
OpenResult: Opened
and this is followed by
Thread : 4248
class : File System
Operation : QueryDirectory
Result: SUCCESS
Path : C:\Documents and Settings\Admin
0: .
1: ..
2: .ezlm20jk
3: Application Data
4: Cookies
5: Desktop
6: Favorites
7: Local Settings
8: My Documents
9: NetHood
10: NTUSER.DAT
11: ntuser.dat.LOG
12: ntuser.ini
13: PrintHood
14: Recent
15: SendTo
16: Start Menu
17: Templates
and see such logs for entire drive...
This seems to slow the launch the application...
Try checking that you have correctly set up a filter in ProcMon pointing to your executable, otherwise ProcMon will collect all system events.