Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

segfault in pg_pathman.so with Postgres 9.5.2 on ubuntu, debian, OSX #21

Closed
Labels
@pavel-kolla-kampiki

Description

From my workstation running Xubuntu 16.04 with 9.5.2:

0x00007ffbd1a821e4 in pathman_rel_pathlist_hook () from /usr/lib/postgresql/9.5/lib/pg_pathman.so

similar issue (with lack of core dumps though) in same situation on Debian 8 and OSX 10.11.4

from postgres log:

2016年07月13日 18:13:20 EEST [18360-2] LOG: server process (PID 18701) was terminated by signal 11: Segmentation fault
2016年07月13日 18:13:20 EEST [18360-3] DETAIL: Failed process was running: 
 SELECT facebook.status_upsert(
 '1_1',
 'link',
 1,
 0,
 4,
 NULL,
 '',
 'name value',
 '2016-02-01T11:02:00+00:00'::timestamptz,
 '2016-02-01T11:01:00+00:00'::timestamptz
 )
2016年07月13日 18:13:20 EEST [18360-4] LOG: terminating any other active server processes

table facebook.status is range-partitioned on id

culprit function:

CREATE OR REPLACE FUNCTION facebook.status_upsert (
 _eid TEXT,
 _etype TEXT,
 _status_type INT4,
 _streaming_status INT4,
 _story_id INT4,
 _stream_id INT4,
 _description TEXT,
 _caption TEXT,
 _as_at_ TIMESTAMPTZ,
 _published_at_ TIMESTAMPTZ
) RETURNS INT AS $$
DECLARE
 _id INT;
 _unchanged BOOL;
BEGIN
-- should only update the row it something has changed. but cannot just put that condition in the criteria of the update
-- statement since we must return the id of the row regardless if it is changed or not
SELECT
 id,
 as_at = _as_at_
 AND etype = _etype
 AND status_type = _status_type
 AND streaming_status = _streaming_status
 AND story_id = _story_id
 AND description = _description
 AND caption = _caption
 AND published_at = _published_at_
 INTO _id, _unchanged
FROM
 facebook.status fs
WHERE
 eid = _eid
;
IF FOUND AND _unchanged THEN
 RETURN _id;
END IF;
LOOP
 -- updates on partitioned tables do return the id of the record updated unlike inserts
 UPDATE facebook.status SET
 etype = _etype,
 status_type = _status_type,
 streaming_status = _streaming_status,
 story_id = _story_id,
 description = _description,
 caption = _caption,
 as_at = _as_at_,
 published_at = _published_at_,
 _as_at = EXTRACT(EPOCH FROM _as_at_),
 _published_at = EXTRACT(EPOCH FROM _published_at_)
 WHERE
 id = _id;
 IF FOUND THEN
 RETURN _id;
 END IF;
 BEGIN
 -- believe that it is highly unlikely that will get a unique_violation for this table
 -- therefore its more efficient to increment the sequence inside the loop right before the insert
 SELECT NEXTVAL('facebook.status_id_seq') INTO _id;
 -- take this out when acquisition can reliable give me the stream_id
 SELECT COALESCE(_stream_id, (SELECT stream_id FROM facebook.page WHERE eid = split_part(_eid, '_', 1))) INTO _stream_id;
 -- inserts on partitioned do not return the id of the record inserted so use explicitly allocated sequence id
 INSERT INTO facebook.status (
 id,
 eid,
 etype,
 status_type,
 streaming_status,
 story_id,
 stream_id,
 description,
 caption,
 as_at,
 published_at,
 _as_at,
 _published_at
 ) VALUES (
 _id,
 _eid,
 _etype,
 _status_type,
 _streaming_status,
 _story_id,
 _stream_id,
 _description,
 _caption,
 _as_at_,
 _published_at_,
 EXTRACT(EPOCH FROM _as_at_),
 EXTRACT(EPOCH FROM _published_at_)
 );
 RETURN _id;
 EXCEPTION WHEN unique_violation THEN
 -- loop again
 END;
END LOOP;
END
$$ language plpgsql;

ubuntu's .crash

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /