cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Symptoms

Inventory is not successfully gathered from a computer running a Unix-like operating system. When inspecting the /var/opt/managesoft/log/tracker.log file, details like the following are observed.

[Thu Apr 12 16:36:37 2018 (G, 0)] {9303} ************************************************************ 
[Thu Apr 12 16:36:37 2018 (G, 0)] {9303} Program arguments are '/opt/managesoft/libexec/ndtrack -t Machine -o Upload=false' 
[Thu Apr 12 16:36:37 2018 (G, 0)] {9303} Preferences loaded 
[Thu Apr 12 16:36:37 2018 (G, 0)] {9303} Inventory Setting file is '/var/opt/managesoft/tracker/inventorysettings/InventorySettings.xml' 
[Thu Apr 12 16:36:37 2018 (G, 0)] {9303} Obtaining semaphore lock (to ensure only one instance is running)... 
[Thu Apr 12 16:36:37 2018 (G, 0)] {9303} ERROR: Could not obtain semaphore lock, Windows error code: 2 
[Thu Apr 12 16:36:37 2018 (G, 0)] {9303} Program exited with code -536870910 
[Thu Apr 12 16:36:37 2018 (G, 0)] {9303} ************************************************************

In particular, this article discusses details about possible causes for the "Windows error code: 2" detail shown after the message "Could not obtain semaphore lock".

Cause

The "Windows error code: 2" message is usually due to the system running out of semaphores to allocate.

Applications such as Oracle Database and Apache HTTP Server can use a lot of semaphores. Any application that consumes many semaphores without freeing them may lead to available semaphores being exhausted, with a symptom being the particular log message details described above.

Steps To Reproduce

  • Reduce operating system semaphore limits to an unrealistically low number.
  • Observe the error when running ndtrack,

Troubleshooting & Mitigation

Commands to investigate semaphore details will vary by operating system. Here are some examples of commands that can be used on Linux-based operating systems to troubleshoot this issue and find out if there are excessive semaphores in use by the system.

  • Show current semaphore limits:
    # ipcs -ls

    ------ Semaphore Limits --------
    max number of arrays = 32000
    max semaphores per array = 32000
    max semaphores system wide = 1024000000
    max ops per semop call = 500
    semaphore max value = 32767
  • Show current semaphore usage:
    # ipcs -us

    ------ Semaphore Status --------
    used arrays = 0
    allocated semaphores = 0
  • Show the processes associated with current semaphores in use:
    # for pid in $(for semid in $(ipcs -s | awk '/0x/{ print $2 }'); do ipcs -s -i $semid | tail -2 | head -1 | awk '{print $5}'; done | sort -u); do ps uh -p $pid; done

After investigating the above you may notice that the semaphore limit is not set high enough or a process is using a lot of semaphores.

Was this article helpful? Yes No
No ratings
Version history
Last update:
‎Apr 08, 2024 11:57 PM
Updated by: