def METHOD_NAME(database, function_scope_messages_aggregator):
    """Test that we protect against the yielding segfault bug that happens when lots
    of complicated actions happen at the same time.
    The bug can be summed up as following:
    1. Get in the progress callback but before the in_callback lock is acquired.
    2. Wait for the lock acquisition and context switch out
    3.A lot of things happen and the callback gets entered by a lot of other sections
    and has the lock acquired. Some of those places do connection.commit
    and modify the connection. As per the docs that's a no no.
    https://www.sqlite.org/c3ref/progress_handler.html
    4. We context switch back to the original callback acquire the lock and then release it
    and the callback is exited. Since the connection has been modified KABOOM SEGFAULT.
    """
    # first write some data in the DB to have enough data to read.
    write_actions(database, 500)
    # Then have lots of stuff happen at the same time so that the situation described
    # in the docstring occurs
    a = gevent.spawn(
        read_actions,
        database=database,
        limit=50,
        msg_aggregator=function_scope_messages_aggregator,
    )
    b = gevent.spawn(
        write_actions,
        database=database,
        num=100,
    )
    c = gevent.spawn(
        write_single_action_frequently,
        database=database,
        num=10,
        sleep_between_writes=0.5,
    )
    d = gevent.spawn(
        read_single_action_frequently,
        database=database,
        msg_aggregator=function_scope_messages_aggregator,
        num=10,
        limit=1,
        sleep_between_reads=0.5,
    )
    e = gevent.spawn(
        write_actions,
        database=database,
        num=100,
    )
    gevent.joinall([a, b, c, d, e])