Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QT5.6 Webengine demo browser carshes at ClientUsageTracker::AddCachedOrigin



  • I have dealt with a strange problem for quite some time and I need some advice to proceed.

    Here are our system configurations:
    TI AM57xx EVM
    OS: Linux: 4.4.19
    QT 5.6
    QT WebEngine with chromium browser 45

    The qtwebengine(widget) demo browser works for all general operations except it crashes at html5test.com while running HTML5Test.

    With QTCreator remote debugger, I found that the program was crashed at

    void ClientUsageTracker::AddCachedOrigin(
    const GURL& origin, int64 new_usage) {
    DCHECK(IsUsageCacheEnabledForOrigin(origin));

    std::string host = net::GetHostOrSpecFromURL(origin);
    int64* usage = &cached_usage_by_host_[host][origin]; // last instruction
    int64 delta = new_usage - *usage;
    *usage = new_usage;
    if (delta) {
    if (IsStorageUnlimited(origin))
    global_unlimited_usage_ += delta;
    else
    global_limited_usage_ += delta;
    }
    DCHECK_GE(*usage, 0);
    DCHECK_GE(global_limited_usage_, 0);
    }
    Which can be traced to the segment fault occurs at
    linaro-2016.02/arm-linux-gnueabihf/include/c++/5.3.1/bits/basic_string.h (109)
    template<typename _CharT, typename _Traits, typename _Alloc>
    class basic_string
    {
    ...
    // Use empty-base optimization: http://www.cantrip.org/emptyopt.html
    struct _Alloc_hider : allocator_type // TODO check __is_final
    {
    _Alloc_hider(pointer __dat, const _Alloc& __a = _Alloc())
    : allocator_type(__a), _M_p(__dat) { }
    ...
    }

    The QT5 Webengine demo program crashes due to a std::map related memory allocation problem at the C++ class ClientUsageTracker where this class is only used by the html5 test code at html5test.com.

    I am able to add the std::map test code at various places such as the demo program, qtwebengine module, other chromium module such as the “cert verify openssl” module and they all work fine. However, the demp program crashes when I add the similar test code at the module ClientUsageTracker.

    typedef std::map<std::string, int64_t> UsageMap2;

    ClientUsageTracker::ClientUsageTracker(
    UsageTracker* tracker, QuotaClient* client, StorageType type,
    SpecialStoragePolicy* special_storage_policy,
    StorageMonitor* storage_monitor)
    : tracker_(tracker),
    client_(client),
    type_(type),
    storage_monitor_(storage_monitor),
    global_limited_usage_(0),
    global_unlimited_usage_(0),
    global_usage_retrieved_(false),
    special_storage_policy_(special_storage_policy) {

    cout << "ClientUsageTracker::ClientUsageTracker" << endl;

    #if 0
    UsageMap2 temp;
    int64_t *t = &temp["Hello"];

    *t = 110;
    cout << "lientUsageTracker::ClientUsageTracker = " << *t <<endl;
    

    #endif

    DCHECK(tracker_);
    DCHECK(client_);
    if (special_storage_policy_.get())
    special_storage_policy_->AddObserver(this);
    }

    If you have any idea or advice, please let me know. If you don’t, please ignore this one. It is highly appreciated that you have read this e-mail.

    Best regards,

    Eric


Log in to reply