Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » MixinModel lacks thread safety (DLTK 2.0)(MixinModel synchronizes cache but not other data structures....)
MixinModel lacks thread safety (DLTK 2.0) [message #653017] Tue, 08 February 2011 01:17
Carl Knight is currently offline Carl KnightFriend
Messages: 13
Registered: December 2010
Junior Member
org.eclipse.dltk.core.mixin.MixinModel is only partially synchronized.

We have multiple threads attempting to use the index and they get into strife calling get(String) on MixinModel. The reason is simple:

	public IMixinElement get(String key) {
		if (DLTKCore.VERBOSE) {
			System.out.println("MixinModel.get(" + key + ')'); //$NON-NLS-1$
		if (notExistKeysCache.contains(key)) {
			return null;
		if (removes == 0) {
			if (cache.get(key) == null) {
				return null;
		MixinElement element = getCreateEmpty(key);
		if (DLTKCore.VERBOSE) {
			System.out.println("Filling ratio:" + this.cache.fillingRatio()); //$NON-NLS-1$
		if (element.isFinal() && element.sourceModules.size() > 0) {
			return element;
		synchronized (this.cache) {
			cache.resetSpaceLimit(CACHE_LIMIT, element);
		return null;

The class members existKeysCache and notExistKeysCache are not synchronized. Multiple threads can access them. The calls to add(key) on the HashMap result in two threads trying to modify the map simultaneously. Specifically a rehash(). This seems to cause the HashMap to either blow up or infinitely loop inside AnalyzeMap().

The solution would be to synchronize these other members as well as the cache.

- Carl.
Previous Topic:DLTK 2.0 CLEAN_BUILD broken?
Next Topic:Save file generates multiple builds
Goto Forum:

Current Time: Wed Feb 21 19:48:12 GMT 2024

Powered by FUDForum. Page generated in 0.03007 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top