Thread

  1. Fw: PortalHeapMemoryFree error in OpenACS

    Brian Mueller <brian@twotomatoes.com> — 2000-08-12T19:07:35Z

    ----- Original Message ----- 
    From: Brian Mueller 
    To: pgsql-bugs@postgresql.org 
    Sent: Monday, August 07, 2000 10:18 AM
    Subject: PortalHeapMemoryFree error in OpenACS
    
    
    
    
    ============================================================================
                            POSTGRESQL BUG REPORT TEMPLATE
    ============================================================================
    
    
    Your name               :     Brian Mueller
    Your email address      :  brian@twotomatoes.com
    
    
    System Configuration
    ---------------------
      Architecture (example: Intel Pentium)         : intel 686
    
      Operating System (example: Linux 2.0.26 ELF)  : RedHat Linux 6.1
    
      PostgreSQL version (example: PostgreSQL-6.5.1):   PostgreSQL-7.0.2
    
      Compiler used (example:  gcc 2.8.0)           : gcc egcs-2.91.66
    
     
    Select version() = PostgreSQL 7.0.2 on i686-pc-linux-gnu, compiled by gcc egcs-2.91.66
    
    
    Please enter a FULL description of your problem:
    ------------------------------------------------
    
    When doing a large query from either an OpenACS 3.2.2 web page (/intranet/employees/admin/index.tcl) or from psql, I get the following error: 
    NOTICE:  PortalHeapMemoryFree: 0x0x41a37610 not in alloc set!
    NOTICE:  PortalHeapMemoryFree: 0x0x41a37cc8 not in alloc set!
    NOTICE:  PortalHeapMemoryFree: 0x0x41a37ca0 not in alloc set!
    ERROR:  btree scan list trashed; can't find 0x0x41a37bf0
    
    
    The PostgreSQL.org doxlist faq says the following... 
    5.2) What does the message "NOTICE:PortalHeapMemoryFree: 
    0x402251d0 not in alloc set!" mean?
    
    You are pfree'ing something that was not palloc'ed. 
    Beware of mixing malloc/free and palloc/pfree. 
    
    
    ...I'm not sure what to do with this information.
    
    The postmaster process looks like so 
      PID TTY      STAT   TIME COMMAND
      476 ?        S      0:04 /usr/local/pgsql/bin/postmaster -B 1000 -S -o -S 8000 -D/usr/local/pgsql/data
    Other inserts and queries can be run in this and other databases through psql or from other OpenACS web pages.
    Thanks for your help. 
    
    The troublesome query (either half of the union can be run successfully): 
    select users.user_id , coalesce(info.salary, 0) as salary, 
    users.last_name || ', ' || users.first_names as name,
                    info.supervisor_id, info.years_experience as 
    n_years_experience, info.salary_period, info.referred_by,
                    to_char(info.start_date,'Mon DD, YYYY') as 
    start_date_pretty,
                    (case when info.project_lead_p = 't' 
    then 'Yes'::varchar else 'No'::varchar end) as project_lead,
                    (case when info.team_leader_p = 't' 
    then 'Yes'::varchar else 'No'::varchar end) as team_lead,
                    (case when supervisor_id is NULL 
    then 'missing'
                     else (select s.first_names || ' ' || s.last_name 
    from users s where s.user_id=supervisor_id) end) as supervisor_name,
                    (case when info.referred_by is NULL 
    then 'nobody'
                     else (select r.first_names || ' ' || r.last_name 
    from users r where r.user_id=referred_by) end) as referral_name
               from users_active users, im_employee_info info, 
    user_group_map ugm
              where users.user_id = ugm.user_id
                and ugm.group_id = 8
                and users.user_id = info.user_id
    union
    select users.user_id , 0 as salary, users.last_name || ', ' || 
    users.first_names as name,
                    '' as supervisor_id, '' as n_years_experience, '' as 
    salary_period, '' as referred_by,
                    '' as start_date_pretty,
                    'No'::varchar as project_lead,
                    'No'::varchar as team_lead,
                    'missing' as supervisor_name,
                    'nobody' as referral_name
               from users_active users, user_group_map ugm
              where users.user_id = ugm.user_id
                and ugm.group_id = 8
                and not exists (select 1 from im_employee_info
                                where user_id = users.user_id)
           order by upper(users.last_name),upper(users.first_names)
    
    
    
    
    
     
    
    Please describe a way to repeat the problem.   Please try to provide a
    concise reproducible example, if at all possible:
    ----------------------------------------------------------------------
    
     
    
     
    
    If you know how this problem might be fixed, list the solution below:
    ---------------------------------------------------------------------
    
     
    
  2. Re: Fw: PortalHeapMemoryFree error in OpenACS

    Tom Lane <tgl@sss.pgh.pa.us> — 2000-08-12T23:25:57Z

    "Brian Mueller" <brian@twotomatoes.com> writes:
    > When doing a large query from either an OpenACS 3.2.2 web page (/intranet/e=
    > mployees/admin/index.tcl) or from psql, I get the following error:=20
    > NOTICE:  PortalHeapMemoryFree: 0x0x41a37610 not in alloc set!
    > NOTICE:  PortalHeapMemoryFree: 0x0x41a37cc8 not in alloc set!
    > NOTICE:  PortalHeapMemoryFree: 0x0x41a37ca0 not in alloc set!
    > ERROR:  btree scan list trashed; can't find 0x0x41a37bf0
    
    Interesting.  However, I can't get excited about having to
    reverse-engineer your database before I can try to duplicate the
    problem.  How about a schema dump (pg_dump -s)?  Also, what query
    plan is shown by EXPLAIN for the problem query?
    
    			regards, tom lane
    
    
  3. Re: Fw: PortalHeapMemoryFree error in OpenACS

    Tom Lane <tgl@sss.pgh.pa.us> — 2000-08-19T20:14:36Z

    "Brian Mueller" <brian@twotomatoes.com> writes:
    > When doing a large query from either an OpenACS 3.2.2 web page (/intranet/e=
    > mployees/admin/index.tcl) or from psql, I get the following error:
    > NOTICE:  PortalHeapMemoryFree: 0x0x41a37610 not in alloc set!
    > NOTICE:  PortalHeapMemoryFree: 0x0x41a37cc8 not in alloc set!
    > NOTICE:  PortalHeapMemoryFree: 0x0x41a37ca0 not in alloc set!
    > ERROR:  btree scan list trashed; can't find 0x0x41a37bf0
    
    Brian, it looks like this problem has already been fixed in current CVS
    sources --- it's a foulup in subplan handling for APPEND plans, which
    basically means that you need sub-SELECTS in a UNION to cause it.
    
    Easiest patch for 7.0.* is to grab src/backend/optimizer/plan/setrefs.c
    out of the CVS server or a recent nightly snapshot tarball and drop it
    into 7.0.* sources as-is.
    
    			regards, tom lane