Break processing of procedure


In very rare cases processing of a button-onclick (send E-mail) procedure freezes on a customer's PC. Till now I haven't been able to trace the cause of this behaviour, but it is of the essence that my application doesn't have to be shutdown (the hard way) in order to preserve some data.

Therefore I want to add an option for the user to KILL the process, without the need to end program execution.

Can anybody advice me on how to accomplish this?
Stef MerlijnDeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Have you tried putting a try/except wrapper in your Button OnClick event handler?
Stef MerlijnDeveloperAuthor Commented:
Yes, but there is no error. It freezes at some point in the process.
You say it is sending an Email. How are you doing that? MAPI?
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Stef MerlijnDeveloperAuthor Commented:
I'm using components from Clever Components Suite. Sending is done directly via SMTP.
Sinisa VukSoftware architectCommented:
Have you contact Clever Components developers? They might help you. They know things under the hood ....
Stef MerlijnDeveloperAuthor Commented:
Yes, we did some logging, but nothing out of the ordinairy.
That's why I ask my question. I ran out of options for now.
I don't know Clever Comp.

Freezing does not necessarily equal crash. Perhaps the component is somehow getting into an endless loop.  

If you can't fix the freeze... let me suggest a different approach: Maybe you could create a fail-safe file that contains critical recovery data before starting your Email process. If the process succeeds (doesn't freeze) you delete the file. If the file exist upon restart then you know the program had to be crashed, therefore you know that you need to apply the recovery data before continuing. I know it's kind of an ugly work-around, of course the best solution is to not freeze in the first place.
Stef MerlijnDeveloperAuthor Commented:
The only way I could recover as suggested, I would need to copy DB-records just before mailing. But in a multi user environment it's not very reliable/useful.

I prefer to terminate the mailing somehow.
Another idea would be to run your email process in a thread. If the thread does not terminate after a *reasonable* amount of time you might be able to  forcefully terminate the thread.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sinisa VukSoftware architectCommented:
... or you can use Indy components....
Stef MerlijnDeveloperAuthor Commented:
Thank you!
Stef MerlijnDeveloperAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.