Thread.join() Hangs Sometime Windows Application?

May 31, 2012

I am developing windows based video application, in my application I have to make multiple video files with different duration from a single video file. To achieve this I am using thread.join method(), when I run my application it works fine but sometimes it hangs and I have got to close my application using Task manager, I can't understand why my application behave like this?.

This generally happens when number of output files are more than 40. Is there any problem with thread.join() function, when number of threads are increased. I am generating a new thread for each output file because this is the limitation of the third party dll which I am using.

View 4 Replies


ADVERTISEMENT

Waiting For Threads - Thread.join Suspend Execution Of Code On Calling Thread Until Spawned Thread Finishes Or Is Aborted

Sep 2, 2010

My understanding is that thread.join will suspend the execution of code on the calling thread until the spawned thread finishes or is aborted...

With that in mind, I tried this:

For i = 1 to 50
threads = New Thread(AddressOf test)
threads.IsBackground = True
threads.SetApartmentState(ApartmentState.STA)

[CODE]...

However, the rest of the code runs when the loop finishes, not waiting for all the spawned threads to finish. Since the rest of the code needs the threads to finish (otherwise the rest will error).

View 4 Replies

Application Hangs When OpenFileDialog = Windows.Forms.DialogResult?

May 19, 2010

Private

Sub Button1_Click(ByVal
sender As
Object,

[code]....

View 9 Replies

Thread.Join Does Not Return With Quitted Thread?

Nov 9, 2011

in my Winforms application, there is a main thread. It is not the UI thread but it starts the UI thread. In the main thread, I'm using a Mutex to prevent the application from being started twice. That's why I'm making an exception from the rule not to use a Thread's Join method. In this case, the main thread does call UIThread.Join before releasing the Mutex. That works well.

The strange problem is: Whenever an exception occurs in the UI thread, the default Windows error dialog pops (send report, debug, close). If I select "close", the application does not quit. Instead, the main window (created in the UI thread) stays visible, but it is inoperatable. It looks as if the UI thread still does not quit, and consequently the main thread's call to UIThread.Join doesn't return either.

Though, if I debug the application at that point, the "threads" window does not show the UI thread anymore. I've given it the name "UI Thread" (surprisingly).So, why does the Join method not return even if the thread has died? Why is a window of a died thread visible?The following screenshot shows the Threads window below and the window above shows the callstack of the main thread ("Hauptthread").

View 7 Replies

.net - Thread.abort Hangs Forever

Sep 15, 2011

Code to launch a wmi query on remote computers. This code runs in several threads at the same time.

[Code]...

For Each objMgmt In oquery.Get 'on some pesky windows XP machines this line hangs forever regardless of the timeout and the thread can never be used to get info from another computer. the only way to "release" this is to reboot the target computer.

[Code]...

View 1 Replies

.net - Scrolling The Scrollbar Of A ConsoleApplication Hangs The Thread?

May 26, 2011

I've got some server apps that I've been trying to get some metrics from so I can debug them. I found that when scrolling back up the window I'd suddenly get timeouts from the clients. Sure enough, moving the scrollbar stopped the application.

I'm probably missing something fundemental here, but I can't work out why moving the scrollbar on a Console window would block the thread. It's very simple to reproduce:

Sub Main()
Do
Console.WriteLine(Now.ToString("O"))

[code]....

Run that up, and any interaction with the window blocks the thread. In the example below, I just moved the scrollbar a bit and held it in position for a few seconds before releasing [URL]I've tried it with a Timer type loop rather than a Thread.Sleep but the same issue appears. What am I doing wrong (other than not using a service instead!)?

View 1 Replies

Wpf - Kill A BackgroundWorker In .net If Thread Hangs Using COM Object?

Jun 10, 2012

I have an application that interacts with third party COM objects. A method of the COM object that I call will sometimes stop responding. I created a Backgroundworker thread to call the function and I am trying to monitor it from my main thread to kill it if it hangs. I have additional code (not supplied) that tracks the processing time using system.timer from the main thread and I raise an event if it exceeds my threshold (this part is fine). This is when I want to kill the thread and stop code execution. The problem is.. if I use the cancelasync method it will just pend since the code execution is stuck on the function call.

The particular function call in the code snippet that hangs is "objCOM.SendDataToServer()". It typically takes 1-3 seconds to return, but if it gets no response it will just hang indefinitely and won't return at all (no errors just hangs).. there is no timeout... and since I don't have access to the source function I cannot supply one. I tried the .dispose() method of the thread, but apparently that doesn't kill it and neither does cancelasync. I just need help figuring out how to KILL this thread so I can reset the server connection and call the function again.

Public Class COMobject
Private objCOM as new acs.manager
Public Sub CallComFunction()

[code]....

View 1 Replies

Join STA Thread To MTA Thread?

Jan 19, 2009

I am facing a problem while joining a STA thread to MTA thread. Actually the requirement was some thing like describe below.

1. I have a exe which is using some dialog boxes.

2. These dialog boxes are using MSFlexGrid. This component is a Com component.

3.so in order to run it with Vb.Net exe i had to run this dialog box in a STA thread.

4. to achive this i created a new thread and set the Apartment status STA.

5.it was working fine when i run the code. but if click on exe than at the time of join it throws an unhandled exception.if i click on continue button of exception dialog box it runs successfully. how ever i can not ignore this exception.

6. exception contains below text (i know its a bog message but i am stuck here for last couple of days.)[code]...

View 13 Replies

Communications :: Windows Form Hangs Or Freezes How Come?

Jan 9, 2011

I put this Code into a module and try to call it to start the Server side of the the applaction there also a Client but the Server side is done in a Console app but when i try to do it in a Windows Form it hangs once called to start listening. [code] i found this code on the internet that i was just playing with. its pretty neat but i cant figure out the program of the Windows form hanging issue.

View 1 Replies

Windows Services Hangs Or Is Stuck At Line

Oct 14, 2010

I'm trying to Debug and code an program in VB.net 2005 in windows XP. When I start my service and attach it for debugging it hangs at the line:System. ServiceProcess.ServiceBase. Run(ServicesToRun)The service says it is started under windows service dialog, but does not go further in the code, it just sits there..Does anyone have any solutions to this problem? I had this problem before but it usually start after a few moments,it seemed to get progresively worst, were now it doesn't progress at all, and just stays hung. [code]

View 6 Replies

.NET Application Hangs When Calling DLL

Dec 28, 2010

Its been running in production for over a year and this is the first time I saw this behaviour. The application is a VB.NET Console Application which is triggered by MQ server. This application uses a class library which is part of the same project(Say 'abc.dll'). In production around 40+ instances of this exe are running and all of them use the some of the functions from 'abc.dll'.

Last week, we noticed that all the 40 instances were shown to be running in the task manager but they were not doing any activity. There was no exception thrown or error logged in Application logs or System logs. To frantically debug the problem, I tried isolating the problem.

With all these 40+ exes hung up, I wrote a small aplication which would use a reference to this 'a.dll', create an object of one of the classes in that dll and execute a method in there. I was printing console.writelines in between to see to which point it gets to before erroring out.

To my surprise, I found that at the point where I was creating an object of a class in 'a.dll' this sample test application would also hang just like the others. No exceptions thrown. So I killed all those applications as a last resort and then when I restarted all of them, everything worked fine.

I couldn't find any explanation for this behaviour. Since it was a critical error affecting a production system(blanking out the application for 3+ hours), I have to give a very good explanation as to why this would occur. how it can be prevented in future.

(Side note: the servers running these appilcation do not have a maintenance schedule and are supposed to be up for couple of months together.

View 11 Replies

VB 2008 Application Hangs?

Mar 6, 2011

I am writing my first application in Visual Basic Express 2008 and the program conistently hangs (Not responding in the Task Manager) midway through execution. The operating system is Windows XP Professional SP3 running on a 1.20 GHz Intel Core Duo CPU with 2 GB of RAM.

The application has very deep layers of subroutines and functions, all of which are using lots of math routines. There are no recursive routines anywhere in the program. The program creates and destroys quite a few class elements, and I have written dispose methods for all of them using IDisposable, setting all the properties to Nothing. I also use GC.Collect() to force garbide collection, and GC.WaitForPendingFinalizers(). As a result, I don't think there are any memory leaks.

I think the depth of sub and function calls are causing a stack overflow, but I'm not certain. I have tried without success to increase the stack allocation to 2 Mb using Editbin.exe after reading some forums, but nothing changed. I then searched my machine and did not find EDITBIN.EXE.When the program hangs up, the background of the forms on the screen turn to solid white and the controls are no longer visible.It looks like a window pops up but it disappears too quickly to read anything. If I view the task manager while the application is running it hangs immediately. I have not published it, I am still developing and running it out of the VB environment.The more complexity (sub and function calls) I add, the earlier the program hangs.

View 6 Replies

.Net Application Hangs If Lock System

Jun 21, 2010

I have a weired problem. I developed a multithreaded WinForm application using VB.Net, and SQL Server 2008. The application works perfectly fine if I am using Visual Studio IDE to run the same. But, if I run the exe file created by VS the application hangs in case I lock my system and again relogin. The memory usage is same as it was before locking the system. CPU usage is also 0% or by max 2%. All threads are also exited after finishing there designated tasks.The application also uses threading but all threads are exited after there designated tasks. I confirmed this using various tools.[code]

View 5 Replies

.Net Application Hangs When Added On Startup?

May 5, 2011

I have created a small multithreaded application using VB.NET. There is no problem when the user manually runs this application. A problem exists when I added this application on startup. It hangs after I rebooted the system. The application is still running its thread but I can't see its GUI because its frozen. If I kill it on task manager and started again, the application works fine. What could be the possible reason/s why this application hangs when added on startup?

Imports System.Threading
Public Class USBLock
Public Event Lock()

[Code]....

or just a thought on this subject: the reason why the program hangs on startup is because the application is loaded while the .net framework service has not yet started.

View 1 Replies

Application Form Hangs But It Is Working

Apr 21, 2011

I have win7 pro, on my win form is a traffic light icon(when it starts it is red, when finished it is green), so that I know when job is finished. But when I run application icon isn't changing and form hangs it self, can not do nothing until job is finished. Only in the end, I see that icon is quickly changes to red and then back to green.

View 1 Replies

Application Hangs On Call To Doevents?

Dec 22, 2010

I am re-posing this question because the prior post has gotten really full of side issues so I fear the main problems has been lost.I have a windows forms application written in VB.NET which scrapes information from serveral web pages? I am having problem with one particular site where partway through the page navigation my application hangs. When I press pause (or break) in the debugger, it stops on a call to System.Windows.Forms.Application.DoEvents.

View 7 Replies

Cross-thread Operation Not Valid Exception In Single Thread Application?

Nov 14, 2009

I am getting this exception: Cross-thread operation not valid: Control 'TextBoxOutput' accessed from a thread other than the thread it was created on. in a VB 2008 Windows Forms application that I havent specifically made multi-threaded. I have create a sub called Out() like this:

Private Sub Out(ByVal inString As String)
Me.TextBoxOutput.Text += (Me.TextBoxOutput.Text & inString & vbNewLine)
Me.TextBoxOutput.SelectionStart = Me.TextBoxOutput.Text.Length
Me.TextBoxOutput.ScrollToCaret()
End Sub

and I call it from various events to log messages I am getting from my pbx, which I use a third party open source dll to access. The interesting thing to me is that if I run the deployed application (ie, not in the VS IDE) I do not get any exceptions, it's only from within the IDE.if I add the line: Control.CheckForIllegalCrossThreadCalls = False to the form's constructor, the exceptions stop, but a) this seems like a hacky way to get around the issue and b) the application seems to hang sometimes when I have it set this way.

View 2 Replies

Thread State - Thread In An Application Which Calls A Sub Routine Main()

Jul 26, 2010

I have a thread in an application which calls a sub routine Main(). The Main sub routine in turn call several sub routines/functions from with the same module,several different classes in the same application. Also some sub routines/functions call routines from a class library. Now say the routine/function in class library goes into a infinite loop and never returns. I would like my thread in the application to raise a event and display message to the users about the infinite loop. I am giving some sample code for the application.

Imports System.Threading

Module VMain
Public gbSuspend As Boolean

[CODE]...

View 7 Replies

.net - Application.Exit Raises `FormClosed` For All Open Forms From Calling Thread, Generating Invalid Thread Accesses?

Oct 31, 2010

My routine to check for updates is run as a separate process. Exiting the application is required to update, so a dialog asks the user, when an update is found, if they want to exit now. f they do, the code (from the update thread) calls Application.Exit().However, if the FormClosed event of any form that needs to be closed needs to access its controls, an invalid cross-thread operation is detected (which sounds pretty logical).

View 1 Replies

Excel Instance Hangs In NET Class Project Application

Aug 7, 2009

I am writing a class project application that is loadable from within AutoCAD. This application generates an Excel workbook with extracted data. I am having a problem with Excel closing when finished. It seems the Excel instance hangs until my application is unloaded. I have found the section of code that seems to be causing to hang, but I'm not sure why its hanging to prevent it.

Below is a copy of my code for the class (top to bottom with exception of the FileExistValidation method... too many characters ). The code section that is commented out seems to be what is causing it to hang. If I uncomment that, Excel hangs, with it commented out, Excel closes out in the background.[code]...

View 10 Replies

FAXCOMEXLib - Sending Fax - Application Hangs When Try To Cancel The Print Dialog Box

Apr 18, 2007

I have a problem when it comes to faxing html. Im currently using FAXCOMEXLib because I'm sending to a remote fax server. Sending html files causes the function ConnectedSubmit to display a print dialog box before sending the fax. The application hangs when you try to cancel the print dialog box, it seems like the ConnectedSubmit function does not return to previous line where it was called.

[Code]...

View 1 Replies

Thread If An Application Is Exited Before The Thread Completes?

Jan 5, 2011

Say i have an application (WPF/WinForm/Whatever)What happens to a thread created via:

Dim t As Thread t = New Thread(AddressOf Me.AddRecords) t.Start()

View 7 Replies

VS 2010 Application Hangs While Moving Data From Text File To Datagridview

Jun 22, 2012

I have a text file which contains large amount (around 44,948 rows/lines & 9 columns) of delimited text data in a text file which I want to populate onto a DataGridView table. I have written the below code, but the application gets hung for the rest of the time & so I have to stop debugging the program.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x As New IO.StreamReader(fileLocationTxt.Text)

[Cdoe].....

View 5 Replies

Inner Join - Join Two Tables,'Employee' And 'Dispatch'

May 17, 2012

Iwant to join two tables,'Employee' and 'Dispatch'. Dispatch has column 'DispatcherID' and 'TechnicianID' which are both foregn keys to EmployeeID in Employee table.I want to join these two tables using EmployeeID so that i can obtain the matching name to each id.but it only works when i make a single join to either DispatcherID or TechnicianID and not for both.

[code]

select Employee.firstname+' '+Employee,secondname as Technician,Employee.firstname+' '+Employee.secondname as Dispatcher from Dispatch inner join Employee on Dispatch.TechnicianID=Employee.EmployeeID inner join Employee on

[CODE]...

View 12 Replies

VS 2010 Error - Cross-Thread Operation Not Valid: Control TbPlaca1 Accessed From A Thread Other Than The Thread It Was Created On

Aug 13, 2010

In one application, I need use 4 simultaneous threads.When the threads finished, I need to update the text of a TextBox.So, I create 4 Textbox, and I wanna the threads change the text to FINISHED.Each thread change one distinct TB.I use this "example"

Dim Terminados As Integer = 0
Private Sub frmEnviarMensagem_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
Timer1.Start()

[code]....

The problem is, I have an error in the red lines.The error is: INVALIDOPERATIONEXCEPTION "Cross-Thread operation not valid: Control tbPlaca1 Accessed from a thread other than the thread it was created on."I don't use cross threading. Each TB only was accessed for the correspondent thread, and for the "main program".

View 3 Replies

Cross-thread Operation Not Valid: Control 'Panel1' Accessed From A Thread Other Than The Thread It Was Created On." ?

Nov 3, 2011

This is the error message I am getting:

"Cross-thread operation not valid: Control 'Panel1' accessed from a thread other than the thread it was created on." The reason I am getting this error is because I am opening up a new form and then calling these three things:

Panel1.Show()
Label1.Show()
Label2.Show()

why I get this error message because it doesn't occur normally if I open Form2 after closing Form1, it only occurs when I open Form2 after closing Form4.

View 4 Replies

Error - Cross-thread Operation Not Valid: Control 'txt1' Accessed From A Thread Other Than The Thread It Was Created On

Jul 21, 2009

I have done a program using vb2005 to display reading from my microcontroller bs2 board but have encountered some problems. My code are as follows.

Dim Stop_Rx As Boolean
Private Sub btnRead_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRead.Click
SerialPort1.Open()

[code]....

I've encounter an error which is, (Cross-thread operation not valid: Control 'txt1' accessed from a thread other than the thread it was created on.)

View 7 Replies

Error : Cross-thread Operation Not Valid: Control 'l_users' Accessed From A Thread Other Than The Thread It Was Created On

Jun 21, 2012

When my client try to connect to server I'm getting this error : Cross-thread operation not valid: Control 'l_users' accessed from a thread other than the thread it was created on.

Private Sub _socketManager_onConnectionAccept(ByVal SocketID As String) Handles _socketManager.onConnectionAccept
l_Users.Items.Add(SocketID)
End Sub

View 3 Replies

Threading Progress Bar In .net - Thread Operation Not Valid Control 'ProgressBar1' Accessed From A Thread Other Than The Thread It Was Created On

Feb 17, 2012

Would anyone be able to help me here please. I'm fairly new to VB.net and threading so im just trying to figure out what is happening.When I debug this I am getting the error thread operation not valid: Control 'ProgressBar1' accessed from a thread other than the thread it was created on.

I'm a little lost as to why the error is occuring or how to fix it. I've had to put the progress bar in a separate thread otherwise the GUI crashes

[Code]...

View 2 Replies

Cross-thread Operation Not Valid: Control 'Autocad' Accessed From A Thread Other Than The Thread It Was Created On

Jun 6, 2010

I have written an application that loads a form - frmCad as well as AutoCad. It does this via a class which detects when AutoCad quits.

Friend Class CadApp Private WithEvents AppObject As AcadApplication... Private Sub AppObject_BeginQuit(ByRef Cancel As Boolean) Handles AppObject.BeginQuit RaiseEvent Quit() End SubEnd Class

My main class loads frmCad as well as CadApp.

Public Class Cad Private WithEvents frmCad As CadForm Private WithEvents app As CadApp... Public Sub ShowForm() If frmCad Is Nothing Then frmCad = New CadForm frmCad.Visible = True End Sub... Private Sub app_Quit() Handles app.Quit frmCad.Dispose() frmCad = Nothing .... End Sub

When I debug the program, it stops at frmCad.Dispose()The program continues to execute, but all the code after it fails to work.Looking more carefully I get an error message which contains:-Cross-thread operation not valid: Control 'Autocad' accessed from a thread other than the thread it was created on.

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved