473,385 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Thread not working

I have a webpage which uploads a big file onto access db.
if the file is say around 30 megs, it'll take around a minute for it to get
put into the access db.
I didn't want the user to wait for it, so I decided to put it on a thread.
The thread works, but not the way it should.
One of my page will start the thread, and then forward the user to another
page.
The thread will start, and browser will get forwarded to the next page, BUT
as soon as I click anything in that second page, the response will be stuck
waiting until the thread processing the upload is done. Now that isn't very
much threaded now is it?...
Why is that happening? is putting stuff on the access db a process that has
to be done alone and can't be threaded?
Thx
Jan 5 '06 #1
8 1605
Jason,

Actually the Thread will die if the page that created the thread is
destroyed. Use a webservice or Ajax to accomplished that.

Cheers
Al

"Jason Chu" wrote:
I have a webpage which uploads a big file onto access db.
if the file is say around 30 megs, it'll take around a minute for it to get
put into the access db.
I didn't want the user to wait for it, so I decided to put it on a thread.
The thread works, but not the way it should.
One of my page will start the thread, and then forward the user to another
page.
The thread will start, and browser will get forwarded to the next page, BUT
as soon as I click anything in that second page, the response will be stuck
waiting until the thread processing the upload is done. Now that isn't very
much threaded now is it?...
Why is that happening? is putting stuff on the access db a process that has
to be done alone and can't be threaded?
Thx

Jan 5 '06 #2
> I have a webpage which uploads a big file onto access db.
if the file is say around 30 megs, it'll take around a minute for it to get
put into the access db.
I didn't want the user to wait for it, so I decided to put it on a thread.
The thread works, but not the way it should.
One of my page will start the thread, and then forward the user to another
page.
The thread will start, and browser will get forwarded to the next page, BUT
as soon as I click anything in that second page, the response will be stuck
waiting until the thread processing the upload is done. Now that isn't very
much threaded now is it?...
Why is that happening? is putting stuff on the access db a process that has
to be done alone and can't be threaded?
Thx


I have heard that IIS queues requests per session. So a second request
within the same session would only be serviced after the first has
completed. (which seems to be the behavior you are seeing)

Hans Kesting
Jan 5 '06 #3
thanx for reply.

As for AJAX, I don't really wanna, cuz all the codes are all done and good
to go in C# (plus there's many components involved....it's just all tied up).
As for Webservices...will that make the processing totally separate from the
other processes from the pages (ie button clicks)? I believe both page
actions and webservices are handled by the same asp.net process. if
threading the database process in a page didn't make it separate (since it
hogged up the whole asp.net process), won't putting it on the webservice do
the same thing? (ie asp.net handles the webservice in another of its own
thread, but that thread hogs up the entire asp.net process, so the page
actions have to wait)
I don't want to move all my code to webservices unless I know that it'll
improve it.

"Albert Pascual" wrote:
Jason,

Actually the Thread will die if the page that created the thread is
destroyed. Use a webservice or Ajax to accomplished that.

Cheers
Al

"Jason Chu" wrote:
I have a webpage which uploads a big file onto access db.
if the file is say around 30 megs, it'll take around a minute for it to get
put into the access db.
I didn't want the user to wait for it, so I decided to put it on a thread.
The thread works, but not the way it should.
One of my page will start the thread, and then forward the user to another
page.
The thread will start, and browser will get forwarded to the next page, BUT
as soon as I click anything in that second page, the response will be stuck
waiting until the thread processing the upload is done. Now that isn't very
much threaded now is it?...
Why is that happening? is putting stuff on the access db a process that has
to be done alone and can't be threaded?
Thx

Jan 5 '06 #4
Thanks for replying.

Before I've put the upload processing function into a thread, I did some
tests with multiple users.
If one of that big upload occurs (so it'll take a minute to process), the
other users will still be able to move around the application for a little
bit, but will be stuck needing to wait after several clicks on the page.
For example
So if A initiate the 1 minute process.
B will be able to surf around for a bit, then after several postbacks, the
next postback will be stuck needing to wait for A's process to finish first
before a response comes back.
Kind of feels like asp.net has a buffer for B to move in...and as soon as
that buffer runs out, B will have to wait.

"Hans Kesting" wrote:
I have a webpage which uploads a big file onto access db.
if the file is say around 30 megs, it'll take around a minute for it to get
put into the access db.
I didn't want the user to wait for it, so I decided to put it on a thread.
The thread works, but not the way it should.
One of my page will start the thread, and then forward the user to another
page.
The thread will start, and browser will get forwarded to the next page, BUT
as soon as I click anything in that second page, the response will be stuck
waiting until the thread processing the upload is done. Now that isn't very
much threaded now is it?...
Why is that happening? is putting stuff on the access db a process that has
to be done alone and can't be threaded?
Thx


I have heard that IIS queues requests per session. So a second request
within the same session would only be serviced after the first has
completed. (which seems to be the behavior you are seeing)

Hans Kesting

Jan 5 '06 #5
How do you start the thread?
Should not be a problem if you are using Thread class.
George

"Jason Chu" <Ja******@discussions.microsoft.com> wrote in message news:6F**********************************@microsof t.com...
I have a webpage which uploads a big file onto access db.
if the file is say around 30 megs, it'll take around a minute for it to get
put into the access db.
I didn't want the user to wait for it, so I decided to put it on a thread.
The thread works, but not the way it should.
One of my page will start the thread, and then forward the user to another
page.
The thread will start, and browser will get forwarded to the next page, BUT
as soon as I click anything in that second page, the response will be stuck
waiting until the thread processing the upload is done. Now that isn't very
much threaded now is it?...
Why is that happening? is putting stuff on the access db a process that has
to be done alone and can't be threaded?
Thx
Jan 5 '06 #6
ProcessorContainer pc = new ProcessorContainer(parameters);
Thread thread = new Thread(new ThreadStart(pc.ProcessUpload));
thread.Start();

simple enough
: )

but if i were to have a problem, then the thread won't even start.

remind you, that the big processing part is shoving the file into the access
db, so the one line causing the wait is the ExecuteNonQuery() of the
OleDbCommand.

"George" wrote:
How do you start the thread?
Should not be a problem if you are using Thread class.
George

"Jason Chu" <Ja******@discussions.microsoft.com> wrote in message news:6F**********************************@microsof t.com...
I have a webpage which uploads a big file onto access db.
if the file is say around 30 megs, it'll take around a minute for it to get
put into the access db.
I didn't want the user to wait for it, so I decided to put it on a thread.
The thread works, but not the way it should.
One of my page will start the thread, and then forward the user to another
page.
The thread will start, and browser will get forwarded to the next page, BUT
as soon as I click anything in that second page, the response will be stuck
waiting until the thread processing the upload is done. Now that isn't very
much threaded now is it?...
Why is that happening? is putting stuff on the access db a process that has
to be done alone and can't be threaded?
Thx

Jan 5 '06 #7
I think you have problem somewhere else. Whatever you are doing with threads looks correct. You might post the whole code for your Page object.

Here are the facts that might help you figure out where problem is.

Session is locked during ASP.NET called. So only one request for one session can come in. Second request (with same SessionID) will be queued.

The page must run through the whole lifecycle in order for Session object to be unlocked for next request.

Response.Redirect( url ) or Response.Redirect( url, true ) will terminate page thus ending it's lifecycle.
Response.Redirect( url, false) will not end the lifecycle you can still be blocking the session.

------------------------------------------------------------------------------------------

I would replace redirect with Response.Write("AAA") and then see if the IE logo in right top corner is spinning.
If it is that means the page is hanging somewhere.
Hope that helps./

George.
"Jason Chu" <Ja******@discussions.microsoft.com> wrote in message news:FA**********************************@microsof t.com...
ProcessorContainer pc = new ProcessorContainer(parameters);
Thread thread = new Thread(new ThreadStart(pc.ProcessUpload));
thread.Start();

simple enough
: )

but if i were to have a problem, then the thread won't even start.

remind you, that the big processing part is shoving the file into the access
db, so the one line causing the wait is the ExecuteNonQuery() of the
OleDbCommand.

"George" wrote:
How do you start the thread?
Should not be a problem if you are using Thread class.


George

"Jason Chu" <Ja******@discussions.microsoft.com> wrote in message news:6F**********************************@microsof t.com...
I have a webpage which uploads a big file onto access db.
if the file is say around 30 megs, it'll take around a minute for it to get
put into the access db.
I didn't want the user to wait for it, so I decided to put it on a thread.
The thread works, but not the way it should.
One of my page will start the thread, and then forward the user to another
page.
The thread will start, and browser will get forwarded to the next page, BUT
as soon as I click anything in that second page, the response will be stuck
waiting until the thread processing the upload is done. Now that isn't very
much threaded now is it?...
Why is that happening? is putting stuff on the access db a process that has
to be done alone and can't be threaded?
Thx

Jan 5 '06 #8
you have the correct approach. nothing in asp.net will cause the behavior
you are seeing, it must be your code forcing serialization. maybe you are
hitting locking problems with the db.

-- bruce (sqlwork.com)


"Jason Chu" <Ja******@discussions.microsoft.com> wrote in message
news:6F**********************************@microsof t.com...
I have a webpage which uploads a big file onto access db.
if the file is say around 30 megs, it'll take around a minute for it to
get
put into the access db.
I didn't want the user to wait for it, so I decided to put it on a thread.
The thread works, but not the way it should.
One of my page will start the thread, and then forward the user to another
page.
The thread will start, and browser will get forwarded to the next page,
BUT
as soon as I click anything in that second page, the response will be
stuck
waiting until the thread processing the upload is done. Now that isn't
very
much threaded now is it?...
Why is that happening? is putting stuff on the access db a process that
has
to be done alone and can't be threaded?
Thx

Jan 5 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Bob Day | last post by:
Using VS 2003, VB, MSDE... There are two threads, A & B, that continously run and are started by Sub Main. They instantiationsl of identical code. Thread A handles call activity on telephone...
1
by: Kevin | last post by:
In a newsgroup thread from Jan 8, 2003 between Barry Holsinger and the VBDotNet Team, please review this excerpt: "You understood my problem completely. Your sample code provides a really...
3
by: brian_harris | last post by:
I am tring to start a thread where I am passing info into thread. According to MS documentation I must do this by creating a class for that thread. I have done this but am getting a compiler...
3
by: Raj Wall | last post by:
Hi, I have an application that uses a number of sub-threads. What is the best way to do some processing in each thread when the main application is shut down? Is the ThreadAbortException...
3
by: ctbfalcon | last post by:
So I have a progress bar that I would like to be diplayed as the program is working on adding a network printer. I want to do this because while the program is "thinking" the user is not sure if...
6
by: HolyShea | last post by:
All, Not sure if this is possible or not - I've created a class which performs an asynchronous operation and provides notification when the operation is complete. I'd like the notification to be...
10
by: Paul E Collins | last post by:
I want to fill an ImageList with bitmaps for a ListView from another thread, because it's a time-consuming process. I expect the ListViewItems' images to "load" one by one, as in a Web browser. ...
0
by: =?Utf-8?B?Q2xhdWRl?= | last post by:
I start a thread when clicking on a button to synchronize data from within my MainForm. In the threaded method, I fire an event to ask stuff to my controler. When I run the application, it works...
9
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I've got a routine that builds a table using different queries, different SQL Tables, and adding custom fields. It takes a while to run (20 - 45 seconds) so I wrote a thread to handle the table...
12
by: Ronny | last post by:
Thanks Chris, Looks nice but I miss the dual way communication. In the main thread to deliver paramters and data to the worker thread- how can I do that? Regards Ronny Take a look at the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.