[Webkit-unassigned] [Bug 70833] New: SerializedScriptValue: lazy initialization of static nullValue not threadsafe

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Oct 25 11:53:25 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=70833

           Summary: SerializedScriptValue: lazy initialization of static
                    nullValue not threadsafe
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebCore Misc.
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: jsbell at chromium.org
                CC: levin at chromium.org


For the origin of the change:
https://bugs.webkit.org/show_bug.cgi?id=41372#c18

For concerns with the implementation, noted while creating a similar method:
https://bugs.webkit.org/show_bug.cgi?id=60197#c13

Short version - this pattern does not look threadsafe:

Source/WebCore/binding/v8/SerializedScriptValue.cpp(1932):
> SerializedScriptValue* SerializedScriptValue::nullValue()
> {
>     DEFINE_STATIC_LOCAL(RefPtr<SerializedScriptValue>, nullValue, (0));
>     if (!nullValue) {
> 	Writer writer;
>         writer.writeNull();
> 	String wireData = StringImpl::adopt(writer.data());
> 	nullValue = adoptRef(new SerializedScriptValue(wireData));
>     }
>     return nullValue.get();
> }

If this will be called from multiple threads, caching should move to the callers. If it will not be called from multiple threads there should be an assertion. Since SSV is used from Workers, the former is more likely to be true.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list