[
https://issues.apache.org/jira/browse/SOLR-2282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12982062#action_12982062
]
Dawid Weiss commented on SOLR-2282:
-----------------------------------
One more side comment for those interested. I used my favorite technique for
debugging such things -- created another project in Eclipse (AspectJ-enabled),
created a runtime weaving launch config in Eclipse that started that particular
test, wrote this aspect:
{noformat}
package com.carrotsearch.aspects;
import java.util.HashMap;
/**
* Check for multithreaded access in supposedly single-threaded objects.
*/
public aspect Solr2282
{
pointcut guardedMethods() :
execution(*
org.carrot2.text.analysis.ExtendedWhitespaceTokenizerImpl.*(..));
private HashMap<Object, Thread> t = new HashMap<Object, Thread>();
Object around() : guardedMethods()
{
Object tokenizer = thisJoinPoint.getThis();
Thread current = Thread.currentThread();
try {
synchronized (Solr2282.class) {
Thread owner = t.get(tokenizer);
if (owner != null && owner != current)
halt();
t.put(tokenizer, current);
}
return proceed();
} catch (Throwable e) {
halt();
return null;
} finally {
synchronized (Solr2282.class) {
Thread owner = t.get(tokenizer);
if (owner != null && owner != current)
halt();
t.remove(tokenizer);
}
}
}
private void halt()
{
System.out.println("## HALT! ");
}
}
{noformat}
and placed a VM-halting breakpoint in sysout inside halt()... Once I got two
threads running on the same tokenizer instance, it was a matter of inspecting
which objects are shared and how this could possibly happen.
Aspect-oriented programming never really won me, but as a debugging/
performance analysis tool it simply rocks.
> Distributed Support for Search Result Clustering
> ------------------------------------------------
>
> Key: SOLR-2282
> URL: https://issues.apache.org/jira/browse/SOLR-2282
> Project: Solr
> Issue Type: New Feature
> Components: contrib - Clustering
> Affects Versions: 1.4, 1.4.1
> Reporter: Koji Sekiguchi
> Assignee: Koji Sekiguchi
> Priority: Minor
> Fix For: 3.1, 4.0
>
> Attachments: SOLR-2282-diagnostics.patch, SOLR-2282.patch,
> SOLR-2282.patch, SOLR-2282.patch, SOLR-2282.patch, SOLR-2282.patch,
> SOLR-2282_test.patch
>
>
> Brad Giaccio contributed a patch for this in SOLR-769. I'd like to
> incorporate it.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]