Page 1 of 1

Deadlock Problems

Posted: Mon Aug 17, 2009 10:47 am
by wasabi2k
lately i have been having issues with random deadlocks the only consistent part is the error :

Image

some info ppl might need :

L2ItemInstance @ 1311:

Code: Select all

	public synchronized void updateDatabase(boolean force)	{        if(isWear())        {        	return; <== line 1311        }		if (_existsInDb)        {
L2ItemInstance @ 1301:

Code: Select all

    public void updateDatabase()    {        this.updateDatabase(false);<== 1301    }
Inventory @ 1292:

Code: Select all

			case L2Item.SLOT_LR_HAND:			{				if (setPaperdollItem(PAPERDOLL_LHAND, null) != null)				{					// exchange 2h for 2h					setPaperdollItem(PAPERDOLL_RHAND, null);					setPaperdollItem(PAPERDOLL_LHAND, null);				}				else					setPaperdollItem(PAPERDOLL_RHAND, null); 				setPaperdollItem(PAPERDOLL_RHAND, item);				setPaperdollItem(PAPERDOLL_LRHAND, item);<== 1292				break;			}
Inventory @ 1242:

Code: Select all

	public L2ItemInstance[] equipItemAndRecord(L2ItemInstance item)	{		Inventory.ChangeRecorder recorder = newRecorder(); 		try<== 1242		{			equipItem(item); 		}		finally		{			removePaperdollListener(recorder);		}		return recorder.getChangedItems();	}
L2PcInstance @ 2461:

Code: Select all

			else			{				sm = new SystemMessage(SystemMessageId.S1_EQUIPPED);				sm.addItemName(item);			}			sendPacket(sm); 			items = getInventory().equipItemAndRecord(item);<== 2461             // Consume mana - will start a task if required; returns if item is not a shadow item            item.decreaseMana(false);        }        sm = null;
since my knowledge about this stuff is still limited i can't really figure out how to solve it ....

any help would really be appreciated.

-wasabi2k-

Re: Deadlock Problems

Posted: Mon Aug 17, 2009 11:20 am
by _DS_
You have other deadlock detector reports ?
Actually it is possible to remove synchronized from updateDatabase(), it will not hurt much (imho). But this is surely an attempt to cheat while enchanting.

Re: Deadlock Problems

Posted: Mon Aug 17, 2009 11:25 am
by wasabi2k
_DS_ wrote:You have other deadlock detector reports ?
nope, the error is always the same.

Re: Deadlock Problems

Posted: Mon Aug 17, 2009 12:42 pm
by _DS_
Inventory@965 and Inventory@153 lines ? Second stack.

Re: Deadlock Problems

Posted: Mon Aug 17, 2009 1:44 pm
by wasabi2k
inventory @ 965:

Code: Select all

	public synchronized void addPaperdollListener(PaperdollListener listener)	{		if (Config.ASSERT) assert !_paperdollListeners.contains(listener);  <== 965		synchronized(_paperdollListeners)		{			_paperdollListeners.add(listener);		} 	}
inventory @ 153

Code: Select all

		ChangeRecorder(Inventory inventory)		{			_inventory = inventory;			_changed = new FastList<L2ItemInstance>();			_inventory.addPaperdollListener(this); <== 153		} 

Re: Deadlock Problems

Posted: Mon Aug 17, 2009 2:51 pm
by _DS_
Ok, thanks, I understand. Until now you can un-synchronize updateDatabase() until new fix will be ready.

Re: Deadlock Problems

Posted: Mon Aug 17, 2009 4:21 pm
by toastgodsupreme
Got this one not too long ago as well. Definitely has something to do with enchanting like DS said.

Re: Deadlock Problems

Posted: Mon Aug 17, 2009 4:23 pm
by DrHouse
Again another problem happening due to 2 packets from same client running at the same time in different threads:

1) UseItem
2) RequestEnchant

I will try to continue work on this when possible...

_DS_: my unfinished multithreaded mmocore in dev-svn should completly bypass these problems without sync, I need time

Re: Deadlock Problems

Posted: Mon Aug 17, 2009 5:22 pm
by _DS_
Today I will try to use lock instead of function synchronization (to avoid locking entire inventory), but need time too...

Re: Deadlock Problems

Posted: Tue Aug 18, 2009 1:54 am
by ThePhoenixBird
Moved to Support Forum