Skip to content

a query is hanged when one of subqueries of CreatingSet throw exceptions #4195

@fzhedu

Description

@fzhedu

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

issue 120 112.sql to tiflash

2. What did you expect to see? (Required)

3. What did you see instead (Required)

the minTSO query is blocked thus all queries are blocked.

4. What is your TiFlash version? (Required)

master

431657087262261385 dot

the task 9 is hanged, which contains three pipelines.

                CreateSet
                /       \
          build       probe
             |            \
        CreateSet       recv
          /      \
    build       probe
        |           |
     agg.         recv
       |
     recv
void CreatingSetsBlockInputStream::createAll()
{
    if (!created)
    {
        for (auto & subqueries_for_sets : subqueries_for_sets_list)
        {
            for (auto & elem : subqueries_for_sets)
            {
                if (elem.second.join)
                    elem.second.join->setFinishBuildTable(false);
            }
        }
        Stopwatch watch;
        auto thread_manager = newThreadManager();
        for (auto & subqueries_for_sets : subqueries_for_sets_list)
        {
            for (auto & elem : subqueries_for_sets)
            {
                if (elem.second.source) /// There could be prepared in advance Set/Join - no source is specified for them.
                {
                    if (isCancelledOrThrowIfKilled())
                        return;
                    thread_manager->schedule(true, "CreatingSets", [this, &item = elem.second] { createOne(item); });
                    FAIL_POINT_TRIGGER_EXCEPTION(FailPoints::exception_in_creating_set_input_stream);
                }
            }
        }

        thread_manager->wait();

        LOG_DEBUG(log, "Creat all tasks of " << mpp_task_id.toString() << " take " << watch.elapsedSeconds() << " sec. ");
        .....

we found the last log is missed, so infer the wait() is blocked. The wait() waits the future being ready from the packed_task, which executes the createOne(). the is a bug when the createOne() does not catch all exceptions, the futrue is blocked.

  • catch all exceptions for createOne()
  • check other places where this bug would occur.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions