Author Topic: how to avoid server busy window in EA?  (Read 15771 times)

Stenvang

  • EA User
  • **
  • Posts: 50
  • Karma: +0/-0
    • View Profile
how to avoid server busy window in EA?
« on: October 06, 2014, 11:33:14 pm »
I'm working on my add-in which do some word automation. Everything worked just fine until I decided to update my c# architecture from single threaded to multithreaded. The word automation is handled from a workerThread and in the meantime the mainThread is just handling a UI where the user can stop the word automation from.

However, ever since I updated the architecture from single to multithreaded EA has begun to throw these "server busy windows".
I can see that the word automation is still running when EA throws this window and I can't seem to figure out why EA has suddenly begun with this problem.

I've searched the internet for an explanation but all I could find was something about EA being a 32bit application and could cause some problems if the IDE was a 64bit. But this is not the case here.

Even though I press "switch to" or "retry" on the window it keeps coming back.

So is it possible to disable this window or solve the problem in another way?

Tehila1

  • EA User
  • **
  • Posts: 256
  • Karma: +0/-0
    • View Profile
Re: how to avoid server busy window in EA?
« Reply #1 on: October 07, 2014, 12:50:16 am »
For me this window appears when I debug my add-in.
Go to Task Manager (Ctrl + Alt + Delete -> Task Manager), In the Processes tab, search for EA.exe, select it and click on the "End Process" button on right-bottom.

Stenvang

  • EA User
  • **
  • Posts: 50
  • Karma: +0/-0
    • View Profile
Re: how to avoid server busy window in EA?
« Reply #2 on: October 07, 2014, 04:57:19 pm »
Thx for the reply. But your solution simply closes down EA which I have no interest in.

I still can't figure out why I didn't have this problem when my add-in was running on a single thread and I get it when it's running with multithreading.

EXploringEA

  • EA User
  • **
  • Posts: 172
  • Karma: +8/-0
    • View Profile
Re: how to avoid server busy window in EA?
« Reply #3 on: October 07, 2014, 06:21:32 pm »
Hi

Not sure it is a threading issue but more likely the threading is exposing your code to a problem I've encountered for years and still don't have a solution :(

Assuming this is the case I found this issue with word, excel and others.  

These applications operate as COM servers to your AddIn code. So when you make a call it initiates the request and provides the response. However, these COM servers have a timeout period, so if the request has not been handled then there is a timeout, and the calling program (EA) will be presented with the dialog stating server busy.

By default the timeout period I  think is 5 secs - so seems long, but in some cases not long enough.

So the answer appears simple - increase the timeout.  Well this was possible prior to .NET  - see http://support2.microsoft.com/kb/240809

However, with .NET, access to COM services is via another layer, and this resulted in changes which mean that this property (along with others) is no longer accessible - see http://msdn.microsoft.com/en-us/library/aa984469

I've played with various workarounds but so far not found anything reliable and fortunately it doesn't present me with a big issue.  Part of the problem with finding the solution is getting a repeatable test case against which to debug and test.

Is you case repeatable?

I hope this helps - and if this it is the same issue I would be interested to know if you i) have a repeatable test case, and ii) find a solution
« Last Edit: October 07, 2014, 06:22:53 pm by MrWappy »
EXploringEA - information, utilities and addins

Stenvang

  • EA User
  • **
  • Posts: 50
  • Karma: +0/-0
    • View Profile
Re: how to avoid server busy window in EA?
« Reply #4 on: October 07, 2014, 06:48:22 pm »
Well the explanation did help and this is definitely something that will take a long time to solve (if possible). I don't got a repeatable test case but I would too greatly appreciate one.

If I don't find a way to increase this timeout I guess I will have to live with the error message since the program is running correctly in the background.

I will let you know if I find anything that could bring me to a solution.

Stenvang

  • EA User
  • **
  • Posts: 50
  • Karma: +0/-0
    • View Profile
Re: how to avoid server busy window in EA?
« Reply #5 on: October 08, 2014, 11:52:49 pm »
By trying to solve another problem I accidently solved this problem - atleast in my case. Not sure if this is a general solution for the server busy problem.

Anyway I had this problem with my multithreading where my workerThread would try to insert something into my word document while the MainThread which holds the word app would do some work on the document. This would result in a classic race condition where an error with "Application busy" would be thrown. Therefore I decided to look for a workaround.

My own suggestion was that I could just retry the call and that was also what people on the internet and even MSDN said.
So I implemented an IMessageFilter like the one on the link below which didn't just remove the server busy error but also got me rid of the server busy window in EA.

http://blogs.artinsoft.net/Mrojas/archive/2012/09/28/Office-Interop-and-Call-was-rejected-by-callee.aspx

@MrWappy Do you have any experience with this solution?
« Last Edit: October 08, 2014, 11:54:24 pm by Stenvang »

EXploringEA

  • EA User
  • **
  • Posts: 172
  • Karma: +8/-0
    • View Profile
Re: how to avoid server busy window in EA?
« Reply #6 on: October 09, 2014, 03:11:46 am »
Hi

Well found - I hadn't come across this solution.  Not asking the right question! But the idea of filtering messages seems pretty sensible.

As you say msdn (http://msdn.microsoft.com/en-us/library/ms228772.aspx ) suggests this so we assume it is the approved method.  Shame MS just don't update the code that wraps COM.

I'll schedule some time to make relevant changes and test, of course the issue is having the test case to verify it works, however seems like you have evidence which is good news.

Many thanks for providing the feedback. :)
EXploringEA - information, utilities and addins

Stenvang

  • EA User
  • **
  • Posts: 50
  • Karma: +0/-0
    • View Profile
Re: how to avoid server busy window in EA?
« Reply #7 on: October 09, 2014, 07:21:29 pm »
Your welcome - glad that I could help!
Even though I forgot to link to the MSDN solution.

BenjaminCervera

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: how to avoid server busy window in EA?
« Reply #8 on: September 27, 2022, 11:37:48 pm »
Hello
Did you find any solution for "Busy Server" problem ?
I have this behavior  on Windows 10/EA13/Local EAP file
BR