Project

General

Profile

Bug #3824

Potential race in WMessageResourceBundle with WServer::setLocalizedStrings

Added by Bruce Toll over 7 years ago. Updated over 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
02/25/2015
Due date:
% Done:

0%

Estimated time:

Description

For static resources where WServer::setLocalizedStrings is provided a WMessageResourceBundle on which refresh() has not been called, it appears that multiple threads can attempt to initialize the WMessageResourceBundle simultaneously. This can result in a segfault.

I noticed this with an earlier github version of Wt 3.3.3-25-g7023b38 when attempting to retrieve several static resources in parallel. I have attached a lightly edited backtrace demonstrating one failure path. I would have liked to provide a self-contained reproducible example, but hopefully this is sufficient.

NOTE: A workaround that seems to help is to call refresh() on the WMessageResourceBundle before passing it to setLocalizedStrings, e.g.

auto message_bundle = new WMessageResourceBundle();
message_bundle->use(server.appRoot() + "report");

// prevent race condition on first use of message_bundle
message_bundle->refresh();
server.setLocalizedStrings(message_bundle);

Files

backtrace_20150225c.txt (6.45 KB) backtrace_20150225c.txt Bruce Toll, 02/25/2015 10:05 PM
#1

Updated by Koen Deforche over 7 years ago

  • Status changed from New to InProgress
  • Assignee set to Benoit Daccache
  • Target version set to 3.3.4

I believe you're right. We should make sure that use of a message resource bundle is thread-safe (which we didn't initially foresee), except for it's refresh(), and properly document this.

#2

Updated by Koen Deforche over 7 years ago

  • Status changed from InProgress to New
  • Assignee deleted (Benoit Daccache)

To be solved together with #3381 by changing WLocalizedStrings API to be stateless: having a new virtual function which takes the locale as paremeter, and deprecating the old ones.

Koen

#3

Updated by Koen Deforche over 7 years ago

  • Target version deleted (3.3.4)

Also available in: Atom PDF