INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Out-of-process COM Problems with JRMC11  (Read 7497 times)

WickedEwok

  • Regular Member
  • Recent member
  • *
  • Posts: 34
  • Software Architect
Out-of-process COM Problems with JRMC11
« on: April 29, 2005, 06:11:59 am »

Hi Matt and crew -
In beta testing our MediaBridge 2 product (which controls MC out-of-process using .NET), a few people have been having troubles.

1) It appears that GetMixer still isn't "seen" in many people's environments. It works flawlessy here on the development machine, making me guess that my work is registering the new interface properly, but that MC on install is still not quite doing so.
2) More sinister is that a few people are having some trouble with the "booting" of MediaCenter. It has great difficulty trying to create a new out of process MJAutomation object, often erroring out with a message that seems to say "COM Server unavailable". When it can start, it looks like it's clearing all of MediaCenter's settings.

I realize this is not enough information for a good debug session, but I thought perhaps it was enough to take a quick look through the COM server code to see if there is anything slightly hokey in there.

My .NET connect code (which works for me in 10 and 11 on my development and production machine) is ...

Code: [Select]
IntPtr ip = NativeWindows.FindWindow("MJFrame",null);
if ((int) ip != 0)
{
try
{
jrmc = (MediaJukebox.MJAutomation) System.Runtime.InteropServices.Marshal.GetActiveObject("MediaJukebox Application");
}
catch(Exception e2)
{
Trace.WriteLine(e2.Message);
}
}
if (jrmc == null){
try
{
jrmc = new MJAutomation();   /* See note below */
jrmc.ShowProgram(1);
}
catch(Exception e)
{
Trace.WriteLine("Error creating MC instance : "+e.Message+e.StackTrace);
MessageBox.Show("There was a problem creating the jrmc instance : "+e.Message+e.StackTrace);
throw e;
}
}
The line marked "see note below" will hang for 20 seconds, and then exit out, unable to create a MC instance. Is it possible it's trying to create an instance, but is hung during init somewhere? Any log I can have the user(s) check?

Thanks for any help you can provide.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41920
  • Shoes gone again!
Re: Out-of-process COM Problems with JRMC11
« Reply #1 on: April 29, 2005, 09:13:08 am »

Here are some ideas:

1) make sure your users have the latest MC 11 (with GetMixer(...) support)
2) manually register Media Center by running "Media Center.exe \Register"
2) tell them to turn on all debug logging in Help > Configure Debug Logging... (and have them send a log when the problem occurs)

Thanks Ben.
Logged
Matt Ashland, JRiver Media Center

WickedEwok

  • Regular Member
  • Recent member
  • *
  • Posts: 34
  • Software Architect
Re: Out-of-process COM Problems with JRMC11
« Reply #2 on: May 16, 2005, 07:19:49 am »

Hi Matt -
Just wanted to post back and say all looks pretty well. I had to wrap some of the calls to the IMJZoneAutomation:GetMixer call in case they have a version with build > 244 but the method wasn't registered properly, but the issues I spoke about here are now resolved.

One other question, however. When I create the MJAutomation object and it has to bootstrap the app, it looks like the app is not using the last maximized state when it starts. Is the intentional?

IE:
1) If I maximize the player, exit, and then restart, the app will be maximized.
2) If I maximize the player, exit, and then use my MediaBridge application to bootstrap the media player, it will start normal (not maximized).
Logged

mhwlng

  • Regular Member
  • World Citizen
  • ***
  • Posts: 235
  • nothing more to say...
Re: Out-of-process COM Problems with JRMC11
« Reply #3 on: May 17, 2005, 02:11:34 am »

2 comments :

1) Bootstrapping MC via COM doesn't work if MC is a library server client (i.e. has no local database)

2) If mediabridge is connected via COM, another application that connects via COM stops working. Is only one COM client supported ?

using MCIO (i.e. CreateObject ("MCIOServer.MediaCentreInsideOutServer.1") ) still works ok...


Regards,

Marcel Houweling
Logged

WickedEwok

  • Regular Member
  • Recent member
  • *
  • Posts: 34
  • Software Architect
Re: Out-of-process COM Problems with JRMC11
« Reply #4 on: June 23, 2005, 08:54:14 pm »

Hi guys -
I have several people complaining about this COM issue of COM not being able to start a Media Server enabled library. Can you take a look why this would be? I simply cannot get a COM object from a Media Center 11 instance that is using a remote library.
Logged

WickedEwok

  • Regular Member
  • Recent member
  • *
  • Posts: 34
  • Software Architect
Re: Out-of-process COM Problems with JRMC11
« Reply #5 on: July 02, 2005, 06:28:24 am »

Further issues, apparently build 301 of MC11 handles something differently than build 299 and older, as a user is now having errors reported when COM tries to close MC. (http://www.promixis.com/phpBB2/viewtopic.php?t=11865).

Thanks guys!
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41920
  • Shoes gone again!
Re: Out-of-process COM Problems with JRMC11
« Reply #6 on: July 15, 2005, 09:58:43 am »

Is there a simple way (code or app) we could use to test and reproduce these problems?  Thanks Ben.
Logged
Matt Ashland, JRiver Media Center

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: Out-of-process COM Problems with JRMC11
« Reply #7 on: July 26, 2005, 04:17:29 pm »

Hi Y'all,

If you are having problems with this, recreate the problem then take a look at your process table. It should have "Media Center.exe" as a process. If there is a "MEDIAC~1.EXE" instead, let me know.

j

Bill Kearney

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 372
Re: Out-of-process COM Problems with JRMC11
« Reply #8 on: July 27, 2005, 12:54:45 am »

I've seen the "won't quit" problem leaving the MEDIAC~1.EXE process running.
Logged

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: Out-of-process COM Problems with JRMC11
« Reply #9 on: July 27, 2005, 03:06:01 pm »

Give MC 11.0.310 a try...

j

SteveC

  • Recent member
  • *
  • Posts: 8
Re: Out-of-process COM Problems with JRMC11
« Reply #10 on: August 17, 2005, 03:31:36 am »

Hi, I'm a complete newbie to this SDK and to be honest, I'm struggling a bit.  I'm starting off trying my hand at VB for various reasons.  Now, the following problems arise:

GetObject(,"MediaJukebox Application") returns ActiveX problems (eg, it's not registered as ActiveX so I can't get it).

The process is showing up as MEDIAC~1.EXE

11.0.310 doesn't appear to be available for download?  latest is 11.0.309?
Logged

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: Out-of-process COM Problems with JRMC11
« Reply #11 on: August 17, 2005, 09:25:13 am »

Try the latest version (312), it includes another fix for the ~ problem.

j

SteveC

  • Recent member
  • *
  • Posts: 8
Re: Out-of-process COM Problems with JRMC11
« Reply #12 on: August 17, 2005, 11:09:45 am »

Great, that update (I'm still showing 11.0.09) solves most of the problems, and to be honest, should be ok to run with.  The only issues are

1/ When I try to close my wrapper app Media center segfaults.  Is it possible for me to close it gracefully with my own program?

2/ I can't attach to an existing Media Center.  To be precise I get "Cannot create ActiveX component." (regardless of whether I try to getobject() or createobject(), but getobject() fails immediatly, createobject() fails in 30 seconds or so).

Logged

mi5

  • Regular Member
  • Recent member
  • *
  • Posts: 16
Re: Out-of-process COM Problems with JRMC11
« Reply #13 on: November 02, 2005, 02:03:03 pm »

2 comments :

1) Bootstrapping MC via COM doesn't work if MC is a library server client (i.e. has no local database)

2) If mediabridge is connected via COM, another application that connects via COM stops working. Is only one COM client supported ?

using MCIO (i.e. CreateObject ("MCIOServer.MediaCentreInsideOutServer.1") ) still works ok...

Just noticed this.  I haven't looked at the MC out-of-process stuff for a while.
Last I checked, it was inconsistent (per MC version).  I didn't think MCIO was
working with newer versions.  Has it been updated?  What does it offer as
compared to direct COM coding?

Logged

cncb

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2918
Re: Out-of-process COM Problems with JRMC11
« Reply #14 on: November 07, 2005, 03:33:13 pm »

I am using 11.0.316 and still seeing "MEDIAC~1.exe"?  As such, it won't seem to kill the process when I exit the client application.
Logged
-Craig    MO 4Media remote and player:  Android/TV/Auto | iOS | Windows 10/UWP

cncb

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2918
Re: Out-of-process COM Problems with JRMC11
« Reply #15 on: November 09, 2005, 08:07:48 pm »

I tried another pc with the same version of Media Center (11.0.316) and I don't get the ~ in the process name?  Any idea why this would be??  They both have Win XP SP2.
Logged
-Craig    MO 4Media remote and player:  Android/TV/Auto | iOS | Windows 10/UWP

Zoner

  • Regular Member
  • World Citizen
  • ***
  • Posts: 198
  • nothing more to say...
Re: Out-of-process COM Problems with JRMC11
« Reply #16 on: December 19, 2005, 08:23:52 am »

I have now installed and tested with build 316, but the problem is not solved.  The only difference that I can see is that the left-over process is now called "Media Center.exe".  However, the process does not close automatically, as I would expect it to.
Logged

Zoner

  • Regular Member
  • World Citizen
  • ***
  • Posts: 198
  • nothing more to say...
Re: Out-of-process COM Problems with JRMC11
« Reply #17 on: January 31, 2006, 01:53:44 am »

This problem is still unresolved.  J River?
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41920
  • Shoes gone again!
Re: Out-of-process COM Problems with JRMC11
« Reply #18 on: February 13, 2006, 11:05:35 am »

Please use the latest 11.1 build.

If it still hangs on shutdown, use logging (Help > Configure Debug Logging...) to see what MC is working on.  Post the results here.

Thanks.
Logged
Matt Ashland, JRiver Media Center

Zoner

  • Regular Member
  • World Citizen
  • ***
  • Posts: 198
  • nothing more to say...
Re: Out-of-process COM Problems with JRMC11
« Reply #19 on: March 02, 2006, 12:00:30 pm »

Sorry about the delay in replying - my music server's fan broke and it's taken a while to get around to fixing it.  I tested this with v11.1 now, and it no longer hangs on shutdown, but I have to click close (or choose File|Exit) three times in order to get it to shutdown - this happens 100% of the time.  Here is the log:

0001797: SDK: CMJAutomation::CMJAutomation: Global Count: 3, Main 0, ffc348
0001797: General: CMCPlayerApp::InitInstance: Updating after database load
0001828: General: CPodcastMain::StartOperation: Start
0001828: General: CPodcastMain::StopOperation: Start
0001828: General: CPodcastMain::StopOperation: Finish (0 ms)
0001844: General: CPodcastMain::ReadConfiguration: Start
0001844: General: CPodcastMain::ReadConfiguration: Finish (0 ms)
0001844: General: CPodcastMain::StartOperation: Finish (16 ms)
0002000: General: CMCPlayerApp::InitInstance: Processing command line
0002000: General: CMCPlayerApp::ExecuteCommandLine: Start
0002016: General: CMCPlayerApp::ExecuteCommandLine: Command Line: -Embedding
0002016: General: CMCPlayerApp::Play: Start
0002016: General: CMCPlayerApp::Play: Command line: -Embedding
0002094: General: CMCPlayerApp::Play: Files: 0
0002094: General: CMCPlayerApp::Play: Finish (78 ms)
0002094: General: CMCPlayerApp::ExecuteCommandLine: Finish (94 ms)
0002094: General: CMCPlayerApp::InitInstance: Updating and showing UI
0002094: General: CMCPlayerApp::InitInstance: Updated window positioning
0002094: General: CMCPlayerApp::InitInstance: Updating startup settings
0002110: General: CMCPlayerApp::InitInstance: Version: JRiver Media Center 11.1.121 (registered)
0002110: General: CMCPlayerApp::InitInstance: Finish (2110 ms)
0002141: SDK: CMJAutomation::CMJAutomation: Global Count: 4, Main 1, f10420
0002156: General: CPodcastMain::Update: Start
0002156: General: CPodcastMain::TallyAndPurge: Start
0002172: General: CPodcastMain::TallyAndPurge: Search Complete
0002172: General: CPodcastMain::TallyAndPurge: Sort Complete
0002172: General: CPodcastMain::TallyAndPurge: Gathered Statistics
0002172: General: CPodcastMain::TallyAndPurge: Finish (16 ms)
0002188: General: CPodcastMain::Update: Finish (32 ms)
0002938: SDK: CMJPlaylistsAutomation::CMJPlaylistsAutomation: Global Count: 1
0002938: SDK: CMJCurPlaylistAutomation::CMJCurPlaylistAutomation: Global Count: 1
0002938: SDK: CMJPlaybackAutomation::CMJPlaybackAutomation: Global Count: 1

That's the end of the startup.  At this point, I waited a few seconds, shut down my app, then waited about 5 seconds, chose File|Exit, waited another 5 seconds or so, chose File|Exit a second time - none of this seemed to generate any logging.  I then waited 5 seconds or so, chose File|Exit a third time, at which point the following logging was generated, and MC11.1 shut down:

0046063: General: CMainFrame::OnDestroy: Start
0046063: General: CMCShutdownHelper::Cleanup: Start
0046063: General: CMCShutdownHelper::Cleanup: Source: CMainFrame - WM_DESTROY
0046063: General: CMCShutdownHelper::Cleanup: Setting shutdown flags
0046063: General: CMCShutdownHelper::Cleanup: Deleting frame member objects
0046063: General: CMCShutdownHelper::Cleanup: Saving data from UI
0046063: General: CMCShutdownHelper::Cleanup: Save window position
0046063: General: CMCShutdownHelper::Cleanup: Hiding UI
0046063: General: CMCShutdownHelper::Cleanup: Stopping playback
0046078: General: CMCShutdownHelper::Cleanup: Saving last exit mode
0046078: General: CMCShutdownHelper::Cleanup: Destroying UI
0046078: General: CMCShutdownHelper::Cleanup: Destroying main UI helper
0046078: General: CMCMainUIHelper::Destroy: Start
0046078: General: CMCMainUIHelper::Destroy: Destroying action windows
0046078: General: CMCMainUIHelper::Destroy: Destroying menu bars
0046078: General: CMCMainUIHelper::Destroy: Destroying player
0046141: General: CMCMainUIHelper::Destroy: Destroying borders
0046141: General: CMCMainUIHelper::Destroy: Destroying search control
0046141: General: CMCMainUIHelper::Destroy: Destroying status bar
0046141: General: CMCMainUIHelper::Destroy: Destroying tree
0046141: General: CMCMainUIHelper::Destroy: Finish (63 ms)
0046141: General: CMCShutdownHelper::Cleanup: Shutting down tools
0046141: General: CInterfacePlugins::CleanUp: Start
0046141: General: CInterfacePlugins::CleanUp: Clearing stored plugin information
0046141: General: CInterfacePlugins::CleanUp: Finish (0 ms)
0046266: General: CPodcastMain::StopOperation: Start
0046266: General: CPodcastMain::StopOperation: All workers cancelled
0046266: General: CPodcastMain::StopOperation: All workers deleted
0046266: General: CPodcastMain::StopOperation: Finish (0 ms)
0046266: General: CMCShutdownHelper::Cleanup: Running shutdown settings
0046266: General: CMCShutdownHelper::Cleanup: Destroying player core
0046266: SDK: CMJAutomation::OnFinalRelease: All objects released
0046266: SDK: CMJAutomation::~CMJAutomation: Global Count: 3
0046281: SDK: CMJAutomation::OnFinalRelease: All objects released
0046281: SDK: CMJAutomation::~CMJAutomation: Global Count: 2
0046281: SDK: CMJMixerAutomation::~CMJMixerAutomation: Global Count: 0
0046281: General: CMCShutdownHelper::Cleanup: Unloading database
0046344: General: CMCShutdownHelper::Cleanup: Clearing save timer
0046344: General: CMCShutdownHelper::Cleanup: Ending background threads
0046344: General: CMCShutdownHelper::Cleanup: Closing services
0046344: SDK: CMJAutomation::OnFinalRelease: All objects released
0046344: SDK: CMJAutomation::~CMJAutomation: Global Count: 1
0046344: General: CMCShutdownHelper::Cleanup: Restoring system settings
0046344: General: CMCShutdownHelper::Cleanup: Revoking automation SDK
0046344: General: CMCShutdownHelper::Cleanup: Releasing objects
0046344: General: CMCShutdownHelper::Cleanup: Unloading skinning
0046360: General: CMCShutdownHelper::Cleanup: Deleting MC core
0046360: General: CMCCore::Destroy: Start
0046360: General: CMCCore::Destroy: Deleting UI
0046360: General: CMCCore::Destroy: Deleting Tools
0046360: General: CMCCore::Destroy: Deleting Player
0046360: General: CMCCore::Destroy: Deleting DB
0046360: General: CMCCore::Destroy: Deleting Router
0046360: General: CMCCore::Destroy: Deleting Factory
0046360: General: CMCCore::Destroy: Deleting Flavor
0046360: General: CMCCore::Destroy: Deleting Services
0046360: General: CMCCore::Destroy: Finish (0 ms)
0046360: General: CMCShutdownHelper::Cleanup: Updating running flags
0046360: General: CMCShutdownHelper::Cleanup: Deleting global objects
0046360: General: CMainFrame::OnDestroy: Start
0046360: General: CMCShutdownHelper::Cleanup: Start
0046360: General: CMCShutdownHelper::Cleanup: Source: CMainFrame - WM_DESTROY
0046360: General: CMCShutdownHelper::Cleanup: Finish (0 ms)
0046360: General: CMainFrame::OnDestroy: Finish (0 ms)
0046360: General: CMCShutdownHelper::Cleanup: Finish (297 ms)

It looks like my code is not properly cleaning up the objects it is using, but I don't really see why that would be the case.  Here is my code:

Code: [Select]
   HRESULT hr = CoInitialize(NULL);

   assert(hr == S_OK);

   hr = MC.GetActiveObject(L"MediaJukebox Application");

   if (hr != S_OK)
   {
      hr = MC.CreateInstance(L"MediaJukebox Application");

      if (hr == S_OK)
      {
         MC->ShowProgram(1);
      }
      else
      {
         char Msg[500];

         sprintf_s(Msg, sizeof(Msg), "Could not access MC automation interface (%#x)", hr);
         MessageBox(0, Msg, "Error", MB_OK);
         Running = FALSE;
         return;
      }
   }

... (lots of code here) ...

   MC.Release();

   delete MC;
   MC = NULL;
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41920
  • Shoes gone again!
Re: Out-of-process COM Problems with JRMC11
« Reply #20 on: April 17, 2006, 04:46:30 pm »

We're doing some tuning for how out-of-proc loading and unloading is handled for MC 12.  Please test once there's a build available.

Thanks.
Logged
Matt Ashland, JRiver Media Center

KingSparta

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 20048
Re: Out-of-process COM Problems with JRMC11
« Reply #21 on: April 18, 2006, 05:41:28 am »

Quote
We're doing some tuning for how out-of-proc loading and unloading is handled for MC 12.

We're doing some tuning

Sounds Like A Currently Ongoing Event, Interesting
Logged
Retired Military, Airborne, Air Assault, And Flight Wings.
Model Trains, Internet, Ham Radio
https://MyAAGrapevines.com
Fayetteville, NC, USA
Pages: [1]   Go Up