473,322 Members | 1,566 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,322 software developers and data experts.

Mysteriously invincible process

I've got a program that contains a crystal report, and it has a function that
saves off one report for each branch of the company, in a loop.
This all works beautifully, however - if the user closes the form while the
saving is taking place (it does take quite a long time) then it mysteriously
CARRIES ON saving the PDFs! The process is still there, just the form is
invisible.
I tried setting a flag to true and calling Dispose on the actual crystal
report ReportDocument object, both of which happen without error, and
although now it stops saving as the flag causes the loop to exit, the process
doesn't die.

Does anybody know of any way to determine what's keeping it alive?

Nov 16 '05 #1
6 1322
Patty O'Dors <Pa********@discussions.microsoft.com> wrote:
I've got a program that contains a crystal report, and it has a function that
saves off one report for each branch of the company, in a loop.
This all works beautifully, however - if the user closes the form while the
saving is taking place (it does take quite a long time) then it mysteriously
CARRIES ON saving the PDFs! The process is still there, just the form is
invisible.
I tried setting a flag to true and calling Dispose on the actual crystal
report ReportDocument object, both of which happen without error, and
although now it stops saving as the flag causes the loop to exit, the process
doesn't die.

Does anybody know of any way to determine what's keeping it alive?


Is it saving the PDFs in another thread? If so, that's probably what's
keeping it alive. The process stays alive until all non-background
threads have terminated.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
Hi,

I think this is what is happening,

Maybe with process explorer from sysinternals.com you can see it.

In any case I think that if this process is going to be so time consuming
that the user may get bored and close the program before it ends you should
try another thing, like scheduling a job to be run in the background or
later, most of the time probably the user that start the process does not
care about the reports in the first time :)

Take a look at this post from Willy
http://groups.google.com/groups?hl=e...ftngp04&rnum=4
Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP***********************@msnews.microsoft.co m...
Patty O'Dors <Pa********@discussions.microsoft.com> wrote:
I've got a program that contains a crystal report, and it has a function that saves off one report for each branch of the company, in a loop.
This all works beautifully, however - if the user closes the form while the saving is taking place (it does take quite a long time) then it mysteriously CARRIES ON saving the PDFs! The process is still there, just the form is
invisible.
I tried setting a flag to true and calling Dispose on the actual crystal
report ReportDocument object, both of which happen without error, and
although now it stops saving as the flag causes the loop to exit, the process doesn't die.

Does anybody know of any way to determine what's keeping it alive?


Is it saving the PDFs in another thread? If so, that's probably what's
keeping it alive. The process stays alive until all non-background
threads have terminated.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #3
Hi Patty,

It should be running on another thread, if it were running on the main
thread ( UI thread ) the interface will lock.

Again, I think that you should consider a non visible method for this,
either a scheduled job or even using MSMQ

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Patty O'Dors" <Pa********@discussions.microsoft.com> wrote in message
news:18**********************************@microsof t.com...
No! It's not. It's right in the button's auto-generated handler.
"Jon Skeet [C# MVP]" wrote:
Patty O'Dors <Pa********@discussions.microsoft.com> wrote:
I've got a program that contains a crystal report, and it has a function that saves off one report for each branch of the company, in a loop.
This all works beautifully, however - if the user closes the form while the saving is taking place (it does take quite a long time) then it mysteriously CARRIES ON saving the PDFs! The process is still there, just the form is invisible.
I tried setting a flag to true and calling Dispose on the actual crystal report ReportDocument object, both of which happen without error, and
although now it stops saving as the flag causes the loop to exit, the process doesn't die.

Does anybody know of any way to determine what's keeping it alive?


Is it saving the PDFs in another thread? If so, that's probably what's
keeping it alive. The process stays alive until all non-background
threads have terminated.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #4
Patty O'Dors <Pa********@discussions.microsoft.com> wrote:
It should be running on another thread, if it were running on the main
thread ( UI thread ) the interface will lock.
The interface doesn't lock - it stays responsive as if I have put it in
another thread, but I'm telling you I haven't.

I can only assume that this is because, although I haven't multithreaded
myself, the method ExportToDisk of the crystal report uses another thread
itself and it is probably this that takes 99% of the time of the loop. It
definitely does seem weird....


I suggest you break into the debugger and see what threads are around
to check it out.
Is what you're saying that if I DO put it in another thread, then it will be
easier to kill it - as I will have an explicit object reference to the thread
that's doing the work, and I will just be able to give it a
ThreadAbortException whenever the form closes?


No - if it's creating a new thread now, I would be very surprised if it
didn't create the thread regardless.

Is there no documented way of waiting until it's finished? If there
was, you could wait for each individual PDF to finish, testing a flag
between each file.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #5
I suggest you break into the debugger and see what threads are around
to check it out.
There's three - one that's listed as being in the button handler function
and two that just have no name. But there are the same three wherever I break
into the program.
Is what you're saying that if I DO put it in another thread, then it will be
easier to kill it - as I will have an explicit object reference to the thread
that's doing the work, and I will just be able to give it a
ThreadAbortException whenever the form closes?
No - if it's creating a new thread now, I would be very surprised if it
didn't create the thread regardless.


From the threads window it would seem that no part of the saving process is
creating any other threads.

Is there no documented way of waiting until it's finished? If there
was, you could wait for each individual PDF to finish, testing a flag
between each file.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #6
Patty O'Dors <Pa********@discussions.microsoft.com> wrote:
I suggest you break into the debugger and see what threads are around
to check it out.


There's three - one that's listed as being in the button handler function
and two that just have no name. But there are the same three wherever I break
into the program.


Hmm.
Is what you're saying that if I DO put it in another thread, then
it will be easier to kill it - as I will have an explicit object
reference to the thread that's doing the work, and I will just be
able to give it a ThreadAbortException whenever the form closes?


No - if it's creating a new thread now, I would be very surprised if it
didn't create the thread regardless.


From the threads window it would seem that no part of the saving process is
creating any other threads.


Hmm. That sounds extremely odd then. Perhaps it's creating other native
threads, and VS.NET doesn't show them? (Not sure.)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #7

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

Similar topics

1
by: Peter Åstrand | last post by:
There's a new PEP available: PEP 324: popen5 - New POSIX process module A copy is included below. Comments are appreciated. ---- PEP: 324 Title: popen5 - New POSIX process module
2
by: Alex Smith | last post by:
Hi all, I have an application that uses Oracle's JDBC thin driver 9.0.x to have a nice, friendly chat with 8.1.x database. During this exchange the server rudely interrupts the conversation and...
2
by: C Kirby | last post by:
I'm running a DB using MSDE (2000) that is interfaced by 2 different ades running on PCs with Access 2000 Runtime. One of the ADEs is a package accounting system that is very solid and stable, the...
12
by: serge calderara | last post by:
Dear all, I have an application which is suppose to start another executable process. As soon as that process is running, I need to retrive its handle. The problem of the particular process I am...
0
by: Jerry Negrelli | last post by:
I have a windows service that is mysteriously dying on me at what appears to be random intervals. Sometimes its 3 hours, sometimes it's 2 days. Clearly an error is occuring but I haven't been able...
2
by: Bonj | last post by:
I have got an issue with a subform of an application that I have. Basically, the subform displays a crystal report, and this works fine - it's just that when you want to close it, it won't close....
0
by: joe martin | last post by:
Sometimes when I run my C# application I am developing the keyboard repeat rate mysteriously goes down all the way. When I check in HKEY_CURRENT_USER\ControlPanel\Keyboard\KeyboardSpeed it is...
3
by: Danny J. Lesandrini | last post by:
I asked this on microsoft.public.access, but got no answers. Maybe I was too verbose ... or there is no answer. User opens form A and then form B While typing in form B, focus jumps to last...
5
by: Todd | last post by:
Hello everyone, I ran a python script last night which connects to a matlab automation server via DCOM (using win32com). I expected to see the results when I came in this morning. But...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.