INTERACT FORUM

Please login or register.

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

Author Topic: Two new MCWS issues with Linux  (Read 1826 times)

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Two new MCWS issues with Linux
« on: August 11, 2023, 11:33:31 am »

As part of my ongoing porting from Windows, I have today come across two MC issues on Linux.

Firstly, the MCWS command 'Control/MCC?Command=20007' (MCC_EXIT) is documented as having parameter (default 0) 'int nMode (0: normal, 1: force close (close media server), 2: force close (allow media server))'. So on Windows I have been sending this command (with no parameter) to clear the screen, but leaving MCWS still running and responsive on the server. On Linux, it kills the server totally. But I find that I can achieve what I need with MCC_MINIMIZE_WINDOW. However, it is a difference in behaviour from Windows to Linux.

Much more significantly, I have a problem with my occasional tree-walk of the (28k-track) library to build a more efficient in-memory representation of Albums and Tracks. This uses a sequence of "Browse/Children" and "Browse/Files" MCWS. This tree-walk has worked well on Windows ever since the introduction of MCWS. But on Linux, after a few hundred calls, one of the calls simply hangs, stopping the processing dead.

I will write a stand-alone tree-walk console program to exercise this. But in the meanwhile is there anything I can check on the server to see how it is failing?
Logged

BryanC

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2663
Re: Two new MCWS issues with Linux
« Reply #1 on: August 11, 2023, 12:02:12 pm »

Re: #1, services are just a completely different beast on Linux than on Windows, thus AFAIK there isn't really a way for Media Server to co-exist in the background alongside the main MC process as there is on Windows (without launching the separate process in read-only mode). Therefore, MCC_MINIMIZE_WINDOW is going to be your best solution without really intricate and delicate workarounds.
Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13875
Re: Two new MCWS issues with Linux
« Reply #2 on: August 11, 2023, 04:14:55 pm »

As part of my ongoing porting from Windows, I have today come across two MC issues on Linux.
...
Much more significantly, I have a problem with my occasional tree-walk of the (28k-track) library to build a more efficient in-memory representation of Albums and Tracks. This uses a sequence of "Browse/Children" and "Browse/Files" MCWS. This tree-walk has worked well on Windows ever since the introduction of MCWS. But on Linux, after a few hundred calls, one of the calls simply hangs, stopping the processing dead.

I will write a stand-alone tree-walk console program to exercise this. But in the meanwhile is there anything I can check on the server to see how it is failing?
Try enabling logging, it might be useful to see what the last thing is did before freezing was.
Logged

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Re: Two new MCWS issues with Linux
« Reply #3 on: August 12, 2023, 12:43:33 am »

Re #2, apologies all. There is no Linux MCWS capacity problem. My tree walk test program showed up a serious inefficiency in my HTTP client code (recently re-worked to allow the move to Linux). So the client was being starved of resources and would hang eventually. There is no obvious problem with MCWS server-side on Linux.

BTW and FYI, the reason for the tree-walk is shown by my test app: "Found 2343 albums with 28573 tracks in 236 seconds". So I do this only occasionally (typically overnight) and cache the album and track data as an XML file - much faster for startup.

Re #1, I am finding occasionally that my MC media server process on Linux is not always there when I expect it. On Windows, it has been rock solid. So I may need to add some process monitoring and spawn a new "MC31 /MediaServer" process as needed.
Logged

BryanC

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2663
Re: Two new MCWS issues with Linux
« Reply #4 on: August 12, 2023, 02:44:44 am »

installJRMC can create systemd services to help facilitate that for you (--service jriver-mediaserver).
Logged

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Re: Two new MCWS issues with Linux
« Reply #5 on: August 12, 2023, 06:07:50 am »

Thanks for the InstallJRMC reference. I had not spotted that capability. I will experiment with it to see the user-mode systemd service is more robust. InstallJRMC does seem very flexible.
Logged

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Re: Two new MCWS issues with Linux
« Reply #6 on: August 13, 2023, 10:06:02 am »

Re: #1, ... Therefore, MCC_MINIMIZE_WINDOW is going to be your best solution without really intricate and delicate workarounds.

I can certainly minimize the window in this way. But nothing I have tried has allowed me (on Ubuntu) to cause MC to display it again. I have tried MCC_MAXIMIZE_WINDOW, MCC_RESTORE_WINDOW, MCC_SET_MODE (of lots of values). I have also tried different mc31 command line parameters. Nothing causes the minimized window to redisplay. They work fine on Windows. The docked MC icon on the Linux desktop animates to attract attention. But I have to explicitly click with my mouse on the icon to get Ubuntu to display anything from a minimized MC. This totally defeats the intent of a system purely controlled through MCWS with a 10-foot view and smart remote control.

Is this a Linux "security feature" that requires user interaction in order to display anything on the desktop??

Even MCC_SET_MODE(UI_MODE_MINI) only briefly displays the "mini" window before minimizing it off the desktop, such that I can't bring it back.

So I can only leave MC permanently displayed on the HTPC desktop, turning the screen off when not wanted. Is this the best I can do? Or is there some other MCWS command I have missed?
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72446
  • Where did I put my teeth?
Re: Two new MCWS issues with Linux
« Reply #7 on: August 13, 2023, 11:19:21 am »

I don't know the answer, but we'll make sure to find one for you or make a change.
Logged

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Re: Two new MCWS issues with Linux
« Reply #8 on: August 13, 2023, 11:43:50 am »

I don't know the answer, but we'll make sure to find one for you or make a change.
Thank you. I know that I am operating at the very edge of what is sensible to do with MC, but it's so near ...
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72446
  • Where did I put my teeth?
Re: Two new MCWS issues with Linux
« Reply #9 on: August 13, 2023, 11:52:17 am »

It's OK.  It's good for us.
Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13875
Re: Two new MCWS issues with Linux
« Reply #10 on: August 14, 2023, 08:23:11 am »

The
/Mediaserver
switch isn't really a server mode.
It's MC in standard mode, error-free (no dialog boxes) brought up Iconic.
That's why it's not responding as you expect to the MCWS.
I haven't tried it but I'm pretty sure you can use that switch on windows or MacOS as well.
The only server mode in MC linux is set in the startup options.
Logged

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Re: Two new MCWS issues with Linux
« Reply #11 on: August 14, 2023, 11:42:09 am »

The
/Mediaserver
switch isn't really a server mode.
It's MC in standard mode, error-free (no dialog boxes) brought up Iconic.
That's why it's not responding as you expect to the MCWS.
I haven't tried it but I'm pretty sure you can use that switch on windows or MacOS as well.
The only server mode in MC linux is set in the startup options.
I am using server mode (installed via installJRMC and in the startup options). But I can find no way to make any MC to appear on the desktop if it has been minimized. This has always worked on Windows. But on Linux I have to be very careful to get an MC on a screen after login and never to let it disappear, If I do, nothing I have found will bring it back other than a user interaction with the desktop.

I am still experimenting, but if you have any ideas I will be very grateful. It is feeling somewhat fragile as I have it now.
Logged

BryanC

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2663
Re: Two new MCWS issues with Linux
« Reply #12 on: August 14, 2023, 01:16:24 pm »

I am using server mode (installed via installJRMC and in the startup options). But I can find no way to make any MC to appear on the desktop if it has been minimized. This has always worked on Windows. But on Linux I have to be very careful to get an MC on a screen after login and never to let it disappear, If I do, nothing I have found will bring it back other than a user interaction with the desktop.

I am still experimenting, but if you have any ideas I will be very grateful. It is feeling somewhat fragile as I have it now.

Instead of using MCC to control the window behavior from within MC, does your window manager or DE offer any commands that could control it externally?
Logged

leezer3

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1588
Re: Two new MCWS issues with Linux
« Reply #13 on: August 14, 2023, 03:03:40 pm »

Have you considered virtual desktops for your use-case?

Just drop the MC window onto a spare virtual desktop, and that solves the minimize/ maximize issue?
Obviously you'd need to hotkey switching desktops on the remote, but it would seem to be a quite good solution.
Logged

max096

  • MC Beta Team
  • Galactic Citizen
  • *****
  • Posts: 363
Re: Two new MCWS issues with Linux
« Reply #14 on: August 14, 2023, 03:17:05 pm »

I can certainly minimize the window in this way. But nothing I have tried has allowed me (on Ubuntu) to cause MC to display it again.

This is what Iīve been using in my docker image to bring back MC when minimized. https://gitlab.com/shiomax/jrivermc-docker/-/blob/main/rootfs/etc/s6-overlay/scripts/prevent-minimize.sh?ref_type=heads

Might work for you too. If you are running wayland it wonīt work as most of the commands to interact with windows arenīt available / not the same / would need to find alternatives. It probably works for desktop environments other than JWM if you are running x11 instead of wayland.

%%MC_VERSION%% is a placeholder you have to replace with the mc version you are using (so 31).
Logged

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Re: Two new MCWS issues with Linux
« Reply #15 on: August 15, 2023, 01:05:18 am »

These are interesting ideas. Thanks all.

I will be experimenting for a few more days. But I am currently running Wayland (Ubuntu 22.04) and this could be a big part of my problem. None of the window automation tools will work.

So I think I should consider moving back to an older pre-Wayland version and experiment there. Maybe I can just disable Wayland in the first instance. The Linux box will be a dedicated HTPC doing nothing but running my own software, a few system services and MC. So as long as MC and JRVR work well on X11, that may be my solution.

My (absolute last option) fall-back position is to leave it all running on Windows!
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Re: Two new MCWS issues with Linux
« Reply #16 on: August 15, 2023, 01:36:00 am »

fwiw using MCC_SHOW_WINDOW works without problems here (debian testing + kde + x11)
Logged

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Re: Two new MCWS issues with Linux
« Reply #17 on: August 15, 2023, 03:04:52 am »

fwiw using MCC_SHOW_WINDOW works without problems here (debian testing + kde + x11)
Brilliant, thank you! I shall install an X11-based system and start testing with that
Logged

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Re: Two new MCWS issues with Linux
« Reply #18 on: August 15, 2023, 10:37:55 am »

Brilliant, thank you! I shall install an X11-based system and start testing with that
Again thank you all!! It's now working perfectly.

I replaced Ubuntu (Wayland) with Kubuntu (KDE) and (after a little taskbar auto-hide tweaking) my software can make MC views come and go as required - all through MCWS calls. And I have had no need of wmctrl or similar tools.

So now I am making real progress. It is starting to look like an elegant system.

It may be worth recording somewhere more visible that Wayland-based systems can't be used for systems which are to be externally controlled.
Logged
Pages: [1]   Go Up