multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.4k stars 435 forks source link

Microsoft Visual C++ Runtime Library error #978

Open FileEX opened 5 years ago

FileEX commented 5 years ago

Describe the bug Some times mta has been crashed and show error. It's totally random and rare.

To reproduce

Expected behaviour Fix it

Screenshots image

Version 1.5.6

Additional context

Pirulax commented 5 years ago

Hm, interesting... My PR had the same problem(#907) if there were a lot of elements in a google::dense_hash_map(in MTA SC referred as CFastHashMap) If i remember correctly its related to some memory issue, namely it can't allocate a new memory buffer for it's elements. Please attach a dump, so I cant find out where the problem is.

FileEX commented 5 years ago

crash dump of this error has not created

Pirulax commented 5 years ago

neat. my pr isn't merged yet, so nothing related to that. without a crashdump it'll be pretty hard to investigate where the problem lies.

ccw808 commented 5 years ago

Does Assertion failed ever give a crash dump?

FileEX commented 5 years ago

In my case, never.

ccw808 commented 5 years ago

What about if you click "Retry" or "Ignore" ?

Pirulax commented 4 years ago

@ccw808 I had the same issue, you can get it quite easily if you use CFastHashMap and fill it with elements(a few million). The interesting this is, it doesnt really run out of memory, but for some reason if fails to allocate it.

void clear_to_size(size_type new_num_buckets)
{
    if (!table)
    {
        table = val_info.allocate(new_num_buckets);
    }
    else
    {
        destroy_buckets(0, num_buckets);
        if (new_num_buckets != num_buckets)
        {            // resize, if necessary
            typedef base::integral_constant<bool, base::is_same<value_alloc_type, libc_allocator_with_realloc<value_type> >::value> realloc_ok;
            resize_table(num_buckets, new_num_buckets, realloc_ok());
        }
    }
    assert(table);
    fill_range_with_empty(table, table + new_num_buckets);
    num_elements = 0;
    num_deleted = 0;
    num_buckets = new_num_buckets;            // our new size
    settings.reset_thresholds(bucket_count());
}
ccw808 commented 4 years ago

I would think the allocation fails because of free memory fragmentation

Pirulax commented 4 years ago

Yeah, thats actually a pretty good explanation, but I guess we can do nothing about it, except maybe replace it with a linked list based map, which probably would be slower due to cache misses.

MichaelFarad commented 2 years ago

@ccw808 I had the same issue, you can get it quite easily if you use CFastHashMap and fill it with elements(a few million). The interesting this is, it doesnt really run out of memory, but for some reason if fails to allocate it.

void clear_to_size(size_type new_num_buckets)
{
    if (!table)
    {
        table = val_info.allocate(new_num_buckets);
    }
    else
    {
        destroy_buckets(0, num_buckets);
        if (new_num_buckets != num_buckets)
        {            // resize, if necessary
            typedef base::integral_constant<bool, base::is_same<value_alloc_type, libc_allocator_with_realloc<value_type> >::value> realloc_ok;
            resize_table(num_buckets, new_num_buckets, realloc_ok());
        }
    }
    assert(table);
    fill_range_with_empty(table, table + new_num_buckets);
    num_elements = 0;
    num_deleted = 0;
    num_buckets = new_num_buckets;            // our new size
    settings.reset_thresholds(bucket_count());
}

Hi, can you please help me where to put this code? how to implement it?

Lpsd commented 2 years ago

@MichaelFarad what exactly are you trying to do?

Pirulax commented 2 years ago

ntoskrnl.exe in System32 should do it. You will have to get the source-code for Windows 10, but that should be easy, as it can be downloaded from here.

Now, jokes aside.. You dont. (... put it anywhere, just leave it here as is.)

MichaelFarad commented 2 years ago

ntoskrnl.exe in System32 should do it. You will have to get the source-code for Windows 10, but that should be easy, as it can be downloaded from here.

Now, jokes aside.. You dont. (... put it anywhere, just leave it here as is.)

help, I beg how can I remove this error, I have been looking for an answer for about a week, you are my hope

MichaelFarad commented 2 years ago

@MichaelFarad what exactly are you trying to do?

I can't fix this error....I'm in the wall, I don't know what to do

Lpsd commented 2 years ago

Nothing described on this page can help you immediately - this is a development discussion.

GitHub isn't for general MTA support. If you're experiencing issues please visit our Discord and use the #help-support channel.