Page 1 of 1

Very strange Illegal Argument Exception

Posted: Fri Jul 09, 2010 8:26 am
by Pere
This is happening in my server since like 6 months ago, when ThreadPoolManager was updated (I get lots of them):

Code: Select all

08-jul-2010 12:49:01 l2tns.gameserver.model.actor.instance.L2PcInstance restoreEffectsADVERTENCIA: Could not restore L2PcInstance:Rizoku[269261888] active effect data: nulljava.lang.IllegalArgumentException	at java.util.concurrent.ScheduledThreadPoolExecutor.scheduleAtFixedRate(Unknown Source)	at l2tns.gameserver.ThreadPoolManager.scheduleEffectAtFixedRate(ThreadPoolManager.java:125)	at l2tns.gameserver.model.L2Effect.setFirstTime(L2Effect.java:278)	at l2tns.gameserver.model.actor.instance.L2PcInstance.restoreEffects(L2PcInstance.java:8500)	at l2tns.gameserver.model.actor.instance.L2PcInstance.restore(L2PcInstance.java:7634)	at l2tns.gameserver.model.actor.instance.L2PcInstance.load(L2PcInstance.java:1325)	at l2tns.gameserver.network.L2GameClient.loadCharFromDisk(L2GameClient.java:500)	at l2tns.gameserver.network.clientpackets.CharacterSelect.runImpl(CharacterSelect.java:92)	at l2tns.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:92)	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)	at java.lang.Thread.run(Unknown Source)
I know that this must be only in my fork, otherwise it would be fixed. But I can't get how the hell can I get an illegal argument exception having this on ThreadPoolManager.scheduleEffectAtFixedRate:

Code: Select all

			delay = ThreadPoolManager.validateDelay(delay);			initial = ThreadPoolManager.validateDelay(initial);			return _effectsScheduledThreadPool.scheduleAtFixedRate(r, initial, delay, TimeUnit.MILLISECONDS); 
where validateDelay() makes sure that these variables will NEVER cause IAE...

Any idea?

Re: Very strange Illegal Argument Exception

Posted: Fri Jul 09, 2010 8:30 am
by janiii
not only you:

http://l2jserver.com/trac/ticket/4750
http://l2jserver.com/trac/ticket/4630


if ( delay < 0 || period < = 0) { throw new IllegalArgumentException(); }

Re: Very strange Illegal Argument Exception

Posted: Fri Jul 09, 2010 8:31 am
by JIV
I know that this must be only in my fork
happens all the time xD, its just ignored :)

problem is:

Code: Select all

        if (period <= 0)            throw new IllegalArgumentException();
period = delay


there were some discussion (i think in dev section) and posted some patches about it but wasnt tested on live.

Re: Very strange Illegal Argument Exception

Posted: Fri Jul 09, 2010 9:00 am
by Pere
Can you put here the possible patch? I will test it on live :P

Anyways, we have these validateDelay functions which avoid the arguments to be <= 0...

EDIT: Ah no, it moves it to 0! Then, instead "if (delay < 0) delay = 0;", we should put "if (delay <=0) delay = 1;".. or won't that work?

Re: Very strange Illegal Argument Exception

Posted: Fri Jul 09, 2010 9:07 am
by JIV
cant find it :x

Re: Very strange Illegal Argument Exception

Posted: Fri Jul 09, 2010 9:10 am
by Pere
threadpoolmanager line ~100

Code: Select all

	public static long validateDelay(long delay)	{		if (delay < 0)			delay = 0;		else if (delay > MAX_DELAY)			delay = MAX_DELAY;		return delay;	}

Re: Very strange Illegal Argument Exception

Posted: Fri Jul 09, 2010 9:12 am
by JIV
that patch , not method :)

Re: Very strange Illegal Argument Exception

Posted: Fri Jul 09, 2010 9:15 am
by Pere
Lol, then even being a patch, it is an unsuccessful one xD