ManiaLive 3.1.0

Discuss the Dedicated Server Tools developed by Nadeo Live such as ManiaLive, Trust Circles, Dedicated Manager, Competition Manager and Lobbies

Moderator: NADEO

oliverde8
Posts: 1345
Joined: 16 Jun 2010, 07:33
Location: in a Blue Box

Re: ManiaLive 3.1.0

Post by oliverde8 »

skyhunter wrote:When enabling all plugins.
MapVote come with an error..

Code: Select all

ERROR: The method 'disableApplicationEvents' can not be called before the
     Plugin 'Standard\MapVote' has been loaded!
There is an error somewhere in the MapVote plugin that causes the MapVote plugin to be unloaded. When the unload is done before the load of the plugin this kind of errors happens. That error is caused by another error and isn't the root of the problem. That is a bit problematic in ML because it makes detection of errors onInit and onLoad very difficult.

If you are on windows check that in your config you have well written 'Standard\MapVote' with the upper cases because that can cause the error. Can you see any other errors? I will try to run it and see if I can see something.

Edit : It runs fine for me, the only way I can reproduce the error is as I said previously not using all the upper cases where they need to be.
Image
Developper for The next generation, Clean and Powerfull controller eXpansion for your SM & TM server . Working on eXpansion² with full MP4 support and many other awesome features...
User avatar
skyhunter
Posts: 22
Joined: 04 Nov 2013, 20:21
Location: Netherlands
Contact:

Re: ManiaLive 3.1.0

Post by skyhunter »

Thx for the reply...
I started a new...cause i could not find any mistypes...(It`s mostly copy/paste)
It works now THX...

Keep getting the SQL is deprecated error but it runs fine... :thumbsup:
oliverde8
Posts: 1345
Joined: 16 Jun 2010, 07:33
Location: in a Blue Box

Re: ManiaLive 3.1.0

Post by oliverde8 »

Hi,

As you know we have been working with reaby on eXpansion plugin pack(specially reaby). We have a slight problem with manialive itself.

First of all the last version is really great, it is very stable and there is no memory leaks, fantastic work.

The problem comes from the generated actions being deleted automatically when they shouldn't. To optimize the number of actions generated you check if an action with the same callbacks exist already, if it do exist then you return that one.
By consequence multiple different windows of different players will use same action's which is nice.

But when a window of another player is destroyed you will destroy all it's actions as well as the actions that are used in other windows and by doing so make that window unusable. What do we do to prevent this?
We may add another parameter in order to make sure that every one of them are unique but that's not very practical and beyond the point. We came up with 2 solutions :

First we are counting the number of times the same action is created and destroy it only if it is destroyed the same amount of time. In a way it allows to count the different places where the action is used and when used in 0 place then destroy :

Code: Select all

<?php
namespace ManiaLive\Gui;

use ManiaLive\Event\Dispatcher;
use ManiaLive\DedicatedApi\Callback\Listener as ServerListener;
use ManiaLive\DedicatedApi\Callback\Event as ServerEvent;

/**
 * Description of ActionHandler
 */
final class ActionHandler extends \ManiaLib\Utils\Singleton implements ServerListener
{
    const NONE = 0xFFFFFFFF;
    
    protected $callbacks = array();
    protected $usage = array();
    
    protected $lastAction = 0;
    
    protected function __construct()
    {
        Dispatcher::register(ServerEvent::getClass(), $this, ServerEvent::ON_PLAYER_MANIALINK_PAGE_ANSWER);
    }
    
    function createAction($callback)
    {
        if(!is_array($callback) || !is_callable($callback))
            throw new \InvalidArgumentException('Invalid callback');
        
        $args = func_get_args();
        array_shift($args);
        $callback = array($callback, $args);
        
        $action = array_search($callback, $this->callbacks, true);
        if($action !== false){
            $this->usage[$action]++;
            return $action;
        }
        $this->lastAction++;
        $action = $this->lastAction;
        $this->usage[$action] = 1;
        $this->callbacks[action ] = $callback;
        
        return $this->lastAction;
    }
    
    // TODO this should be done automatically but PHP has no refcount function
    // nor weak references yet... so please don't forget to call this method
    // to avoid memory leaks !!!!
    function deleteAction($action)
    {
        if(isset($this->usage[$action])){
            $this->usage[$action]--;
            if($this->usage[$action] == 0){
                unset($this->callbacks[$action]);
                unset($this->usage[$action]);
           }
        }
    }
 
    //...
}

?>
This do work but, as old plugins used to destroy their actions manually many does 2 destruction which causes the action to be still destroyed to fast. We might say it isn't compatible with current plugins but is a working solution.

The second solution would be to generate a new action always without checking if the old ones exist :

Code: Select all

 
<?php

namespace ManiaLive\Gui;

use ManiaLive\Event\Dispatcher;
use ManiaLive\DedicatedApi\Callback\Listener as ServerListener;
use ManiaLive\DedicatedApi\Callback\Event as ServerEvent;

/**
 * Description of ActionHandler
 */
final class ActionHandler extends \ManiaLib\Utils\Singleton implements ServerListener
{
   const NONE = 0xFFFFFFFF;
   
   protected $callbacks = array();
   protected $usage = array();
    
   protected $lastAction = 0;
   
   protected function __construct()
   {
      Dispatcher::register(ServerEvent::getClass(), $this, ServerEvent::ON_PLAYER_MANIALINK_PAGE_ANSWER);
   }
   
   function createAction($callback)
   {
      if(!is_array($callback) || !is_callable($callback))
         throw new \InvalidArgumentException('Invalid callback');
      
      $args = func_get_args();
      array_shift($args);
      $callback = array($callback, $args);
      
      $action = ++$this->lastAction;
      $this->callbacks[$action] = $callback;
        
      return $this->lastAction;
   }
   
   // TODO this should be done automatically but PHP has no refcount function
   // nor weak references yet... so please don't forget to call this method
   // to avoid memory leaks !!!!
   function deleteAction($action)
   {
        unset($this->callbacks[$action]);
   }
   //....

?>
This works fine with all our current plugins, we are testing it to see if it causes any memory issues.

It would be nice to have a fix on this issue, at least if we knew what the fix will be so that we can start making changes it necessary

Reaby has also found a version of ManiaLive on github? What is the plans in the future, do you intend to switch to github? it would allow us to help in fixing some small bugs at least in order to make manialive development faster.

Thanks, :thumbsup:
Image
Developper for The next generation, Clean and Powerfull controller eXpansion for your SM & TM server . Working on eXpansion² with full MP4 support and many other awesome features...
The_Big_Boo
Posts: 1041
Joined: 15 Jun 2010, 15:46

Re: ManiaLive 3.1.0

Post by The_Big_Boo »

I didn't checked your code but from what you're telling, I think there's a conception misunderstanding.

When you call createAction method, it can indeed return an already existing action if the callback already exists itself. The thing is to know what's a callback in PHP:
- a global function name (but this case is kind of forbidden here because of POO)
- an array with a class name and a static method name
- or an array with an instance and a method name

Usually, in ManiaLive, callbacks are using either a plugin instance or a window instance. If it concerns a plugin instance but you create and destroy actions in windows then there's a problem because the plugin instance is unique (while the windows are not, obviously).

It's a matter of which class is responsible for creating and destroying an action. If the action points to a plugin method, then the plugin has to handle it and if a window need it, it just ask it to the plugin.


Maybe I'm totally wrong here because I'm just making assumptions but I'm sure it can help anyway.
OS: Win 7 Pro x64
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310
oliverde8
Posts: 1345
Joined: 16 Jun 2010, 07:33
Location: in a Blue Box

Re: ManiaLive 3.1.0

Post by oliverde8 »

Hey,

You are probably :D right but it doesn't solve the problem. I will take the example of my HudMenu where I create in the plugin all actions at the beginning. There is no action created after the onLoad. Then as I display a window I affect to the Controller the action created earlier on.
When my window is destroyed all controls are and when controls are destroyed then the actions on the controls are automatically destroyed as well.
I still have a action number but it isn't mapped anymore. So clicking won't call the method I want to call. In this case it isn't very important because I use the same Controls all throught the life of the plugin as well so I just override the destroy method to prevent the control to be destroyed and prevent the actions of being destroyed as well

There is some cases where we do let's say the mistake of creating actions with callbacks to the plugin in the windows but I would like to point out that the standard library does the same and that many plugins in the standard library doesn't work either.
For me learning that we shouldn't do it is something new. Until know doing that way worked fine and the PluginManager does this the MapVote plugin...

It would be nice to know the intention of the developers magnetik?. The way BigBoo thinks looks to me very logical in the event where actions aren't automatically destroyed ;but in the current situation actions are destroyed so they need to be created in the window, and they need to have a callback to the object of the window to work. Which is nearly equivalent as my proposal of generating a new action always and never using old one(they will be destroyed in any event)
Image
Developper for The next generation, Clean and Powerfull controller eXpansion for your SM & TM server . Working on eXpansion² with full MP4 support and many other awesome features...
The_Big_Boo
Posts: 1041
Joined: 15 Jun 2010, 15:46

Re: ManiaLive 3.1.0

Post by The_Big_Boo »

I checked your plugin and what you're actually doing is creating action inside the button so that's not the same case I talked about and the problem here is actually not about the actions but the controls.

After investigation, I found that the commit 559 totally changed the way I intended the GUI to work. Indeed, as you wanted to do for both performance and memory usage improvements, there's no need to create the exact same button hundreds of times when you could simply share it between windows and that's exactly why I decided a container doesn't own the objects thus shouldn't destroy them. This commit broke this behaviour by doing the opposite and as I had re-wrote some of the standard plugins that way, they're broken too since then...

I don't know what's the purpose of such a change but it's indeed a major compatibility break. You were using that feature exactly the way I wanted to so I can only support you on that ^_^
OS: Win 7 Pro x64
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310
reaby
Posts: 1032
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

Re: ManiaLive 3.1.0

Post by reaby »

Hmm.. Looks like Storage class doesn't sync player rankings (best time and best checkpoints) when manialive is restarted during match... (also it doesn't sync the $this->checkpoins array)...

I believe it's easy fix by addign this line to last thing at onInit-method.

Code: Select all

$this->updateRanking($this->connection->getCurrentRanking(-1, 0));
By doing this it triggers the event Event::ON_PLAYER_NEW_RANK quite many times, if some plugin is attached to the event, so what i think is a proper fix follows:

Code: Select all

function onInit() {
...
$this->updateRanking($this->connection->getCurrentRanking(-1, 0), false);

}

protected function updateRanking($rankings, $announce = true)  {
...
if (!$player->isSpectator && $rankOld != $player->rank && $announce == true)
...
}
Pedrolito
Posts: 2
Joined: 21 Dec 2012, 21:58

Re: ManiaLive 3.1.0

Post by Pedrolito »

Hi Guys !
I'm looking for installing Manialive on my serveur with MPCM to manage match result and all the other stuff :)
For the moment, I always have the same error message when I start the run.bat

Code: Select all

 _|      _|                      _|            _|        _|
 _|_|  _|_|    _|_|_|  _|_|_|          _|_|_|  _|            _|    _|    _|_|
 _|  _|  _|  _|    _|  _|    _|  _|  _|    _|  _|        _|  _|    _|  _|_|_|_|
 _|      _|  _|    _|  _|    _|  _|  _|    _|  _|        _|  _|  _|    _|
 _|      _|    _|_|_|  _|    _|  _|    _|_|_|  _|_|_|_|  _|    _|        _|_|_|
-----------------------------------------------------
PHP Environment Compatibility Test
-----------------------------------------------------
PHP 5.3.1 or newer    -> required  -> [ Yes ] 5.5.9
Standard PHP Library  -> required  -> [ Yes ]
JSON                  -> required  -> [ Yes ]
cURL with SSL         -> required  -> [ Yes ] 7.30.0 (with OpenSSL/1.0.1e)
MySQL                 -> optional  -> [ Yes ]
SQLite3               -> optional  -> [ Yes ]
-----------------------------------------------------
Running ManiaLive 3.1.1...
[01:25:11] Current map: A08
[PluginHandler] Start plugin load process:
[PluginHandler] All registered plugins have been loaded

Fatal error: Class 'Maniaplanet\WebServices\HTTPClient' not found in C:\Users\pe
dro\Desktop\pedro\manialive\libraries\ManiaLive\Features\Updater.php on line 79
Press any key to continue . . .
What's wrong ?
oliverde8
Posts: 1345
Joined: 16 Jun 2010, 07:33
Location: in a Blue Box

Re: ManiaLive 3.1.0

Post by oliverde8 »

Hi,
I have actually opened a ticket in github for this but maybe should have posted here,
here is the problem we have : https://github.com/maniaplanet/manialive-lib/issues/7

I have tweeked the GuiHandler to catch the errors and restart the process of ending manialinks without the multicall so that one call only fails and not all of them, but I think it isn't the solution as the problem seems to come from windows sent to multiple players.
I haven't tested it yet, not sure it will change anything.

Edit : we never used to have this problem before MP3 and we had nearly a 100 players a few times.
Image
Developper for The next generation, Clean and Powerfull controller eXpansion for your SM & TM server . Working on eXpansion² with full MP4 support and many other awesome features...
The_Big_Boo
Posts: 1041
Joined: 15 Jun 2010, 15:46

Re: ManiaLive 3.1.0

Post by The_Big_Boo »

oliverde8 wrote:Edit : we never used to have this problem before MP3 and we had nearly a 100 players a few times.
That's actually because my version of dedicated-api library has a feature the old one hadn't: if you use multicall but there's only a single request pending, it sends the request directly (without multicall encapsulation) thus any fault sent back by the server generate an exception. With the multicall encapsulation, exceptions aren't created (because the answer is an array which may contains faults instead of a fault) but it doesn't mean everything was fine.

Anyway, I'll look into it but if you can give me an easy repro, that would really help me ^^


Edit: btw, when a player disconnects, the GuiHandler is already doing the Window::Erase($login) so you don't need it ;)
OS: Win 7 Pro x64
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310
Post Reply

Return to “Dedicated Server Tools”

Who is online

Users browsing this forum: No registered users and 1 guest