• 0

[VB 2005] error The semaphore timeout period has expired.


Question

hi.

i'm currently developing an application, that uses a usb bluetooth adapter to connect to three codebar readers, so far so good, they are connected, and should be working properly.

but after one hour, one hour and half, sometimes even less, they no longer can't work with the application, i can't get them to read anything.

and sometimes, as the application is starting up i get the following error:

  Quote
Timestamp: 19-03-2009 21:02:34

Message: There is no explicit mapping for the categories 'Geral'. The log entry was:

Timestamp: 19-03-2009 21:02:34

Message: ERRO EVENTO LOAD FRMMAIN: The semaphore time-out period has expired.

# at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)

at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)

at System.IO.Ports.SerialPort.Open()

at Supervisor.FrmMain.FrmMain_Load(Object sender, EventArgs e)

Category: Geral

Priority: 3

EventId: 0

Severity: Error

Title:

Machine: PCEV1198

App Domain: Supervisor.exe

ProcessId: 1864

Process Name: C:\Program Files\KEMET\SupervisorGlobal\Supervisor.exe

Thread Name:

Win32 ThreadId:1756

Extended Properties:

Category:

Priority: -1

EventId: 6352

Severity: Error

Title:

Machine: PCEV1198

Application Domain: Supervisor.exe

Process Id: 1864

Process Name: C:\Program Files\KEMET\SupervisorGlobal\Supervisor.exe

Win32 Thread Id: 1756

Thread Name:

Extended Properties:

could they be related, both of the situations?

i've been searching for a solution for this situation an came up with nothing specific.

i'm using 3 serial port objects to connect to the codebar readers.

and using the following code to connect to the codebar readers.

SerialPort1.PortName = "COM3"  



SerialPort1.BaudRate = 9600   

SerialPort1.DataBits = 8   

SerialPort1.StopBits = Ports.StopBits.One   

SerialPort1.Parity = Ports.Parity.None   

SerialPort1.Open()   

System.Threading.Thread.Sleep(2000)   

'#Dim Porta2 As String = DevolvePOrtaComumicacoes(2, Area.IDArea)   



SerialPort2.PortName = "COM5"  



SerialPort2.BaudRate = 9600   

SerialPort2.DataBits = 8   

SerialPort2.Parity = Ports.Parity.None   

SerialPort2.StopBits = Ports.StopBits.One   

SerialPort2.Open()   

System.Threading.Thread.Sleep(2000)   





'#Dim Porta3 As String = DevolvePOrtaComumicacoes(3, Area.IDArea)   



SerialPort3.PortName = "COM7"  



SerialPort3.BaudRate = 9600   

SerialPort3.Parity = Ports.Parity.None   

SerialPort3.DataBits = 8   

SerialPort3.StopBits = Ports.StopBits.One   

SerialPort3.Open()   

System.Threading.Thread.Sleep(2000)

and the datarecieved event to handle the data recieved from the bar code readers

like the example bellow:

 Private Sub SerialPort1_DataRecieved(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived   

		Try  
			Dim leitor As Integer = 1   

			Leitura.Leitura = SerialPort1.ReadExisting   
			InterpretaComando(Me, leitor, Leitura, Generica.Colaborador)   
			Leitura.Leitura = ""  

		Catch ex As Exception   
			Log("SerialPort1 error: " + ex.Message + " # " + ex.StackTrace)   
		Finally  
			SerialPort1.DiscardInBuffer()   
			SerialPort1.DiscardOutBuffer()   
		End Try  
	End Sub

i've searching and could not find any answer for this issue.

any ideas?

help would be appreciated.

thanks in advance

5 answers to this question

Recommended Posts

  • 0

i can tell you what you may already know, a semaphore timeout means there is a deadlock occurring, i am guessing dining philosophers

my guess is that each process 1 is trying to grab a resource, which is held by process 2. And process 2 wants to grab the resource that is held by process 1, thus deadlock and timeout.

There is not much to go on with the code you have provided, but im sure you'll find the solution!

  • 0

sorry about the late reply...

here's the code i'm using for the connection to the barcode readers.

Private Sub FrmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		Try
			'# chama a sub para actualizar os controlos das maquinas no form
			ActualizaMaquinasForm(Me, Area.IDArea)
			'# 



			If Generica.ModoLeitura = False Then
				'#  Dim Porta1 As String = DevolvePOrtaComumicacoes(1, Area.IDArea)
				SerialPort1.PortName = "COM3"
				SerialPort1.BaudRate = 9600
				SerialPort1.DataBits = 8
				SerialPort1.StopBits = Ports.StopBits.One
				SerialPort1.Parity = Ports.Parity.None

				SerialPort1.DtrEnable = True
				SerialPort1.RtsEnable = False

				SerialPort1.Open()

				'# testes leitores
				System.Threading.Thread.Sleep(5000)

				'#Dim Porta2 As String = DevolvePOrtaComumicacoes(2, Area.IDArea)
				SerialPort2.PortName = "COM5"
				SerialPort2.BaudRate = 9600
				SerialPort2.DataBits = 8
				SerialPort2.StopBits = Ports.StopBits.One
				SerialPort2.Parity = Ports.Parity.None

				SerialPort2.DtrEnable = True
				SerialPort2.RtsEnable = False



				SerialPort2.Open()
				System.Threading.Thread.Sleep(5000)


				'#Dim Porta3 As String = DevolvePOrtaComumicacoes(3, Area.IDArea)
				SerialPort3.PortName = "COM7"
				SerialPort3.BaudRate = 9600
				SerialPort3.DataBits = 8
				SerialPort3.StopBits = Ports.StopBits.One
				SerialPort3.Parity = Ports.Parity.None

				SerialPort3.DtrEnable = True
				SerialPort3.RtsEnable = False

				SerialPort3.Open()
				System.Threading.Thread.Sleep(5000)



				Timer1.Interval = 3600000
				Timer1.Enabled = True
				'# 
			End If
		Catch ex As Exception
			Log("ERRO EVENTO LOAD FRMMAIN: " + ex.Message + " # " + ex.StackTrace)
		End Try
	End Sub

forgot to add this, that timer stated above, named timer1 when it runs disconnects the connection to the barcode readers, and tries to reconnect as stated below.

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
		Dim portacom As String
		Try




			Dim portacomunica As String = ""
			With SerialPort1

				.Close()



				'#Dim porta1 As String = DevolvePOrtaComumicacoes(1, Area.IDArea.ToString)

				.PortName = "COM3"
				.BaudRate = 9600
				.DataBits = 8
				.StopBits = Ports.StopBits.One
				.Parity = Ports.Parity.None

				SerialPort1.DtrEnable = True
				SerialPort1.RtsEnable = False
				.Open()
				System.Threading.Thread.Sleep(1000)
				Application.DoEvents()

			End With

			With SerialPort2



				'#Dim porta2 As String = DevolvePOrtaComumicacoes(1, Area.IDArea.ToString)
				.Close()
				.PortName = "COM5"
				.BaudRate = 9600
				.DataBits = 8
				.StopBits = Ports.StopBits.One
				.Parity = Ports.Parity.None

				SerialPort2.DtrEnable = True
				SerialPort2.RtsEnable = False

				.Open()
				System.Threading.Thread.Sleep(1000)
				Application.DoEvents()

			End With

			With SerialPort3


				.Close()
				.PortName = "COM7"
				.BaudRate = 9600
				.DataBits = 8
				.StopBits = Ports.StopBits.One
				.Parity = Ports.Parity.None

				SerialPort3.DtrEnable = True
				SerialPort3.RtsEnable = False
				.Open()
				System.Threading.Thread.Sleep(1000)
				Application.DoEvents()
			End With
		Catch ex As Exception
			Log("Erro TImer1: " + ex.Message + "#" + ex.StackTrace)

		End Try
	End Sub

any ideas on how to solve this issue?

Edited by paxa
  • 0

and i've been researching a little further, and it seems that there is a deadlock in the communications. it seems that way, that the first serial port is still connecting, while the second is attempting and so on.

could it be that changing the connection part to work by threads and use a mutex to give priority to them work?

thanks in advance

help would be appreciated

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Weekend PC Game Deals: Total War grabs, management freebies, demos to try, and more by Pulasthi Ariyasinghe Weekend PC Game Deals is where the hottest gaming deals from all over the internet are gathered into one place every week for your consumption. So kick back, relax, and hold on to your wallets. The Humble Store brought out a couple of fresh bundles this week, and up first is the Narrative Arc collection. This comes with Mutazione, Venba, and Frank and Drake in the starting tier with an $8 price tag. Going up a rung will cost you $14, and this adds on Season: A Letter to the Future and Dustborn. Lastly, paying $20 gets you Harold Halibut and Six Ages 2: Lights Going Out. Next, the Case and Consequences Collection landed. This bundle comes with Heavy Rain, Song of Farca, Lacuna, and Sherlock Holmes: Crimes and Punishments in the starting tier for $6. The second and final tier of this bundle costs $10, adding on Murders on the Yangtze River, BROK the InvestiGator, and Between Horizons. Both bundles will come to an end two weeks from now, so you have plenty of time to decide. The Epic Games Store's mystery giveaways came to an end this week, but the standard promotion has already returned, touting a freebie from Sega. The Two Point Studios-developed construction and sim experience Two Point Hospital is now yours to claim. Arriving as a spiritual successor to the classic title Theme Hospital, this also offers a humorous take on hospital management and patient treatment. You'll be creating treatment rooms, hiring doctors, and taking care of financials, all the while patients with the wildest illnesses pass through looking for cures. The Two Point Hospital giveaway will last until Thursday, June 19. This is also when The Operator will become the next free game on the platform. Free Events The demo festival that Valve hosts three times a year, Steam Next Fest, is back with a brand-new selection of games to try out. This promotion is slated to last until June 16, giving you just a few more days to try out gameplay slices from upcoming games. Several standard free events are currently active too. This includes the colony sim Stardeus, the dungeon-crawler roguelite Barony, the WW2-set hardcore first-person shooter Hell Let Loose, the building and management sim Construction Simulator, as well as the side-scrolling looter brawler Towerborne. Big Deals The Steam Summer Sale is just days away, but plenty of publishers already having big promotions on their games. This includes a Total War historical sale, Konami classics, 505's early summer promotions, and others. With those and more, here's our hand-picked big deals list for this weekend: SILENT HILL 2 – $41.99 on Steam Forza Horizon 5 – $29.99 on Steam Hell Let Loose – $24.99 on Steam Wasteland 3 – $19.99 on Steam Resident Evil 4 – $19.99 on Steam Metro Awakening – $19.99 on Steam Halo Infinite (Campaign) – $19.79 on Steam Mind Over Magic – $18.74 on Steam Castlevania Dominus Collection – $17.49 on Steam DEATH STRANDING DIRECTOR'S CUT – $15.99 on Steam Blasphemous 2 – $14.99 on Steam Grand Theft Auto V Enhanced – $14.99 on Steam Total War: THREE KINGDOMS – $14.99 on Steam Total War: ROME II - Emperor Edition – $14.99 on Steam DRAGON BALL Z: KAKAROT – $12.99 on Gamesplanet DREDGE – $12.49 on Steam Fable Anniversary – $12.24 on Steam METAL GEAR SOLID V: The Definitive Experience – $11.99 on Steam Total War: ROME REMASTERED – $10.19 on Steam Pillars of Eternity II: Deadfire – $9.99 on Steam Bloodstained: Ritual of the Night – $9.99 on Steam Ghostrunner 2 – $9.99 on Steam METAL GEAR SOLID 3: Snake Eater - Master Collection Version – $9.99 on Steam METAL GEAR SOLID 2: Sons of Liberty - Master Collection Version – $9.99 on Steam Barony – $9.99 on Steam Total War: PHARAOH – $9.99 on Steam DRAGON BALL FighterZ – $9.59 on Steam Deep Rock Galactic: Survivor – $9.09 on Steam The Callisto Protocol – $8.99 on Steam Quantum Break – $7.99 on Steam Oxygen Not Included – $7.49 on Steam The Ascent – $7.49 on Steam Ghostrunner – $7.49 on Steam Total War: SHOGUN 2 – $7.49 on Steam Overcooked! 2 – $6.24 on Steam Human Fall Flat – $5.99 on Steam Grand Theft Auto IV: The Complete Edition – $5.99 on Steam Don't Starve Together – $5.09 on Steam Last Day of June – $4.99 on Steam ABZU – $4.99 on Steam Super Meat Boy Forever – $4.99 on Steam Total War: MEDIEVAL II – Definitive Edition – $4.99 on Steam Legend of Grimrock 2 – $4.79 on Steam Golf With Your Friends – $4.49 on Steam Rise of the Tomb Raider – $4.49 on Steam Golf It! – $4.49 on Steam Sunset Overdrive – $3.99 on Steam Super Meat Boy – $3.74 on Steam Tomb Raider – $2.24 on Steam Crime Boss: Rockay City – $1.99 on Steam Mortal Shell – $1.49 on Steam Crypt of the NecroDancer – $1.49 on Steam This War of Mine – $0.99 on Steam Two Point Hospital – $0 on Epic Store DRM-free Specials The DRM-free discounts from the GOG store this weekend include open-world adventures, story-rich titles, indies, publisher sales, and more. Here are some highlights: No Man's Sky - $23.99 on GOG The Thaumaturge - $19.24 on GOG INDIKA - $16.24 on GOG Against the Storm - $14.99 on GOG Shadows of Doubt - $14.99 on GOG EVERSPACE 2 - $14.99 on GOG Core Keeper - $13.99 on GOG art of rally - $12.49 on GOG Shadowrun Trilogy - $10.07 on GOG Cold Waters - $9.99 on GOG Disco Elysium - The Final Cut - $9.99 on GOG Streets of Rage 4 - $9.99 on GOG Dying Light: The Following – Enhanced Edition - $8.99 on GOG Potion Craft: Alchemist Simulator - $7.99 on GOG Little Nightmares - $4.99 on GOG Edge Of Eternity - $4.49 on GOG Epistory - Typing Chronicles - $4.49 on GOG This War of Mine: Complete Edition - $4.07 on GOG Graveyard Keeper - $3.99 on GOG Alba: A Wildlife Adventure - $3.39 on GOG Chroma Squad - $2.24 on GOG EVERSPACE - $0.99 on GOG Keep in mind that availability and pricing for some deals could vary depending on the region. That's it for our pick of this weekend's PC game deals, and hopefully, some of you have enough self-restraint not to keep adding to your ever-growing backlogs. As always, there are an enormous number of other deals ready and waiting all over the interwebs, as well as on services you may already subscribe to if you comb through them, so keep your eyes open for those, and have a great weekend.
    • I've had the opposite honestly Linux always just works except for games with drm/anti cheat Windows is sometimes corrupted on first install Windows update downloading wrong drivers ...
    • Microsoft 365 Copilot Notebooks now integrated in OneNote on Windows by Paul Hill Microsoft has announced that Enterprise customers with Microsoft 365 Copilot, SharePoint, or OneDrive licenses can now use Microsoft 365 Copilot Notebooks integrated directly with OneNote on Windows. Copilot Notebooks are AI-powered and bring together different resources such as Copilot Chat, files, notes, and links into a single space to make you more productive. The Redmond giant wants to make it easier for customers to gather content, understand complex topics, and create “smarter content” with Copilot Notebooks. This integration is squarely aimed at Enterprise customers, not Personal or Family subscribers. How Copilot Notebooks enhance productivity in OneNote When you open OneNote on Windows, you should see Copilot Notebooks in the left-hand sidebar, from here you can view or edit existing notebooks or you can create one by going to Home > Create Copilot Notebook or New notebook. During the creation of your new notebook, you can give it a name and add references such as OneNote pages, .docx, .pptx, .xlsx, .pdf, or .loop files. This gives Copilot extra context to provide you with more refined answers. Once you have created a notebook and added your reference documents, you can use Copilot Notebooks to help you gather insights from your documents, draft summaries, and generate audio overviews. An important caveat to mention about these notebooks is that you can only add 20 files as references and only individual OneNote pages, as opposed to sections and notebooks, can be added. Microsoft could add support for these in the future, but you can’t add them yet. Another limitation right now is that some OneNote features aren’t functional within Copilot Notebooks, including tags, section groups, inking, templates, password protection, Immersive Reader, and offline support. Availability and what it means for enterprise users Microsoft 365 Copilot Notebooks in OneNote for Windows are available for Enterprise customers with an appropriate license (anyone with a Microsoft 365 Copilot, SharePoint, or OneDrive license) running OneNote Version 2504 (Build 18827.20128) or later. If you have any other feedback to give to Microsoft, you can give it via Help > Feedback. As an Insider preview, Microsoft will likely improve this before declaring it stable so let Microsoft know of any issues you have. Now that the feature is available as a preview, it’s the perfect time for IT admins and other decision-makers to evaluate the feature to see how it could benefit their wider organization.
    • Mixxx 2.5.2 by Razvan Serea Mixxx is powerful, free, and open-source DJ software designed for both beginners and professionals. It offers real-time beatmatching, auto DJ, effects, and MIDI controller support. With a clean interface and compatibility across Windows, macOS, and Linux, Mixxx is ideal for live performances, radio broadcasts, or practice sessions. Its active community and constant updates make it a reliable tool for any DJ. Mixxx integrates the tools DJs need to perform creative live mixes with digital music files. Whether you are a new DJ with just a laptop or an experienced turntablist, Mixxx can support your style and techniques of mixing. Mixxx key features: Realtime audio engine with low-latency performance MIDI and HID controller mapping with customizable scripting (JavaScript-based) Vinyl DVS support (absolute & relative timecode modes) OpenSL, ASIO, WASAPI, and JACK audio backend support Advanced BPM & musical key detection (KeyFinder integration) Quantized beat sync and phase locking Effect chain routing with LADSPA plugin support 4-deck mixing with independent EQ and gain control Support for wide file formats (MP3, FLAC, OGG, WAV, AIFF) Broadcasting via Icecast and Shoutcast with metadata support Library with Crate, Playlist, and Smart Playlist organization Multi-core CPU support for performance optimization Microphone and Auxiliary input routing with talkover ducking OSC and Web MIDI support Skinnable and themable Qt-based UI Cue points, hotcues, and looping with quantization Recording in lossless WAV or compressed formats Clock-synced looping and beatjump Mixxx 2.5.2 changelog: Library Fix playlist export when name contains a dot Fix loading the wrong track via drag and drop when using symlinks Fix: byte order in hotcue comments imported from rekordbox Tracks table: show ReplayGain with max. 2 decimals, full precision in tooltip Fix keyboard mappings with non-ASCII characters on Linux Computer feature: enable initial sorting during population Computer feature: avoid false-positve 'has children' for non-directory links Fix column header mapping when using external library Fixed Single track cover reload on reload metadata from file Controller Mappings Arturia KeyLab Mk1: initial mapping Denon MC7000: slicer mode TypeError Denon MC7000: crossfader curve using wrong parameter DJ TechTools MIDI Fighter Twister: support 4 decks Hercules DJControl Inpulse 500: the crossfader was not reaching 100% to the right end Icon Pro Audio iControls: initial mapping Numark Mixtrack Platinium FX: Fix 4 steps browsing issue Traktor Kontrol S3: Use GUI config for settings Traktor S2 MK3: Fixed LED issue Traktor S4 MK2: Use engine settings API for configuration Traktor S4 MK3: prevent sync lockup, add setting for tempo center snap Controller Backend Control picker: Allow to learn MIDI Aux/Mic enable controls Make [Main],headSplit CO persistent across restart Fix MIDI Controller button learning Fix learning with "No Mapping" selected Unit tests for engine.beginTimer engine-api.d.ts: brake()/spinback() documentation Target support Fix building with a CMake multi-config setup Fix building with gcc >= 14 with LTO and clang >= 19 (fpclassify) Fix: gcc -Warray-bounds= in fidlib by using a flexible member Added Linux Mint Codenames to debian_buildenv.sh Add hidden [Config],notify_max_dbg_time setting to reduce warnings in developer mode Detect arch and fail early if not supported when installing buildenv Misc Vinyl Control: Reduce sticker drift Fix infinite number of pop ups of the "No Vinyl|Mic|Aux|Passthrough input configured" dialog Reduce CPU usage with Trace log messages Fix adjust Gain after adopting it as ReplayGain only in requesting playe Skins: add loop anchor toggle to Deere, Shade, Tango Sound Hardware preferences: add manual link for Mic monitoring modes Work around an Ubuntu, Ibus or Qt issue regarding detecting the current keyboard layout. Fix BPM rounding for the 3/2 case Update cue & play indicators on paused decks when switching cue mode Download: Mixxx 2.5.2 | 113.0 MB (Open Source) Links: Mixxx Home page | Other OSes | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • One Month Later
      5i3zi1 earned a badge
      One Month Later
    • Week One Done
      5i3zi1 earned a badge
      Week One Done
    • Week One Done
      julien02 earned a badge
      Week One Done
    • One Year In
      Drewidian1 earned a badge
      One Year In
    • Explorer
      Case_f went up a rank
      Explorer
  • Popular Contributors

    1. 1
      +primortal
      543
    2. 2
      ATLien_0
      227
    3. 3
      +FloatingFatMan
      159
    4. 4
      Michael Scrip
      113
    5. 5
      +Edouard
      96
  • Tell a friend

    Love Neowin? Tell a friend!