[#13251] - textElement markup="html" multithreading bug

Category:
Bug report
Priority:
Normal
Status:
Acknowledged
Project: Severity:
Minor
Resolution:
Open
Component: Reproducibility:
Sometimes
Assigned to:

Hello,

I noticed some random differences using textElement markup="html" in a multi-threaded environment, mostly disappearing text, but also sometimes an extra newline.

After a bit of digging in the code, I think the problem lies in the class JEditorPaneHtmlMarkupProcessor when using a JEditorPane for HTML parsing (which is a Swing component). Below is a test that will fail quite often (but not at every run). I put an assert() just after JEditorPanel use to check the number of elements and it failed.

public class HtmlMultithreadingTest {

public static class HtmlTask implements Runnable {

@Override
public void run() {
JEditorPaneHtmlMarkupProcessor instance = JEditorPaneHtmlMarkupProcessor.getInstance();
String result = instance.convert("<p>Vestibulum ante</p><p>ipsum primis</p>");
Assert.assertEquals("Vestibulum ante\nipsum primis", result);
}
}

@Test
public void go() throws InterruptedException, ExecutionException {

ExecutorService executorService = Executors.newFixedThreadPool(8);
ArrayList<Future<?>> futures = new ArrayList<>();
for(int i = 0; i < 100000; i++) {
Future<?> submit = executorService.submit(new HtmlTask());
futures.add(submit);
}
for(Future<?> f: futures) {
f.get();
}
executorService.shutdown();
executorService.awaitTermination(1, TimeUnit.DAYS);
}
}

v6.12.2
peni18's picture
2
Joined: Nov 23 2020 - 3:04am
Last seen: 3 months 1 week ago

2 Comments:

#1
  • Status:New» Acknowledged
#2

Nothing has happened on this bug report for a long time, so I just wanted to add, that I still have this issue in v6.20.0. I have experienced missing text, but also text from one instance leaking into another instance.

Feedback
randomness