[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: possible gc/weak hash table bug
From: |
michaelawells |
Subject: |
Re: possible gc/weak hash table bug |
Date: |
Thu, 17 Mar 2011 22:31:13 -0500 |
I replaced vacuum_weak_hash_table with the following:
> static void
> vacuum_weak_hash_table (SCM table)
> {
> SCM buckets = SCM_HASHTABLE_VECTOR (table);
> unsigned long k = SCM_SIMPLE_VECTOR_LENGTH (buckets);
> size_t len = SCM_HASHTABLE_N_ITEMS (table);
>
> unsigned long org_k = SCM_SIMPLE_VECTOR_LENGTH (buckets);
> size_t org_len = SCM_HASHTABLE_N_ITEMS (table);
>
>
> if (len>0) {
> while (k--)
> {
> size_t removed;
> SCM alist = SCM_SIMPLE_VECTOR_REF (buckets, k);
> alist = scm_fixup_weak_alist (alist, &removed);
> if (! (removed <= len)) {
> fprintf(stderr,"$$$ k = %lu (%lu) removed = %i len = %i
> (%i)\n",k,org_k,removed,len,org_len);
> }
> assert (removed <= len);
> len -= removed;
> SCM_SIMPLE_VECTOR_SET (buckets, k, alist);
> }
>
> SCM_SET_HASHTABLE_N_ITEMS (table, len);
> }
> }
Two failure occurred in two different runs. Each time, the debugging message
was the same:
> $$$ k = 89 (113) removed = 1 len = 0 (5)
> hashtab.c:145: vacuum_weak_hash_table: Assertion `removed <= len' failed.
This happened while vacuuming bucket 89 (of 113). The original length was 5.
Again, this problem occurs both infrequently and intermittently.
On Mar 17, 2011, at 7:09 PM, michaelawells wrote:
> As requested, I'm posting this to address@hidden
>
> I'm now seeing this assertion failure, using a guile development snapshot
> (guile-2.0.0.104-f5fc7):
>
>> dpm.linux: hashtab.c:136: vacuum_weak_hash_table: Assertion `removed <= len'
>> failed.
>
>
>> static void
>> vacuum_weak_hash_table (SCM table)
>> {
>> SCM buckets = SCM_HASHTABLE_VECTOR (table);
>> unsigned long k = SCM_SIMPLE_VECTOR_LENGTH (buckets);
>> size_t len = SCM_HASHTABLE_N_ITEMS (table);
>>
>> while (k--)
>> {
>> size_t removed;
>> SCM alist = SCM_SIMPLE_VECTOR_REF (buckets, k);
>> alist = scm_fixup_weak_alist (alist, &removed); <<<**** FAILS HERE
>> assert (removed <= len);
>> len -= removed;
>> SCM_SIMPLE_VECTOR_SET (buckets, k, alist);
>> }
>>
>> SCM_SET_HASHTABLE_N_ITEMS (table, len);
>> }
>>
>
>
> Unfortunately, this problem is infrequent and intermittent. In my case, it
> happened in 10 out of 1000 runs.
>
> Currently, I don't know of a way to reproduce the problem.
>
>
>
> On Mar 17, 2011, at 4:43 AM, Andy Wingo wrote:
>
>> Hi Michael,
>>
>> Thanks for the report. In the future, please copy address@hidden; it
>> doesn't hurt.
>>
>> On Thu 17 Mar 2011 00:56, michaelawells <address@hidden> writes:
>>
>>> hashtab.c:203: weak_bucket_assoc: Assertion `(((scm_t_hashtable *)
>>> ((((scm_t_bits) (0? (*(SCM*)0=((((SCM *)((scm_t_cell *) (((scm_t_bits)
>>> (0? (*(SCM*)0=((((table))))): (((table)))))))) [((2))]))): (((SCM
>>> *)((scm_t_cell *) (((scm_t_bits) (0? (*(SCM*)0=((((table))))):
>>> (((table)))))))) [((2))]))))))->n_items) >= args.removed_items'
>>> failed.
>>>
>>> Did you ever see this assertion fail?
>>
>> No I didn't, and that bothers me a little.
>>
>>> I tried using a development snapshot (guile-2.0.0.104-f5fc7). When I
>>> use this snapshot, I do not see this problem.
>>
>> There were certainly some bugs fixed. Let's assume that it's fixed in
>> git, and in the upcoming 2.0.1 (should be a week or so). There are
>> still some lingering issues with weak hash tables, but we are working on
>> them; and certainly no crashes that we know of.
>>
>> Have fun with Guile,
>>
>> Andy
>> --
>> http://wingolog.org/
>