Data too long for column 'parent_id'

Created on 6 June 2023, about 1 year ago
Updated 9 June 2023, about 1 year ago

I'm using the queue-based ad tracker but getting this in the log:

Drupal\Core\Entity\EntityStorageException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'parent_id' at row 1: INSERT INTO "ad_track_event" ("type", "uuid", "user", "created", "ad_id", "ip_address", "user_agent", "url", "page_title", "referrer", "page_view_id", "session", "parent_id") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12)

...

[:db_insert_placeholder_12] => AD_TRACK_IMPRESSION_ID_PLACEHOLDER AND 2680=(SELECT UPPER(XMLType(CHR(60)||CHR(58)||CHR(113)||CHR(113)||CHR(120)||CHR(112)||CHR(113)||(SELECT (CASE WHEN (2680=2680) THEN 1 ELSE 0 END) FROM DUAL)||CHR(113)||CHR(107)||CHR(113)||CHR(106)||CHR(113)||CHR(62))) FROM DUAL)-- vMux )

๐Ÿ› Bug report
Status

Active

Version

4.0

Component

ad module

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States derekw

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @derekw
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly plach Venezia

    Can you post the ad_track_event table schema? Also, which DBMS? :)

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States derekw

    This is on Pantheon so MariaDB is the DBMS.

    the parent_id field is set to varchar(255) but the placeholder string is 276 long.

    ad_track_event:

    id bigint UNSIGNED Not Null
    type varchar(255) Not Null
    uuid varchar(128) Not Null
    user
    int UNSIGNED COMMENT ''The ID of the
    target entity.''
    created int
    ad_id varchar(255)
    ip_address varchar(255)
    user_agent longtext
    url longtext
    page_title longtext
    referrer longtext
    page_view_id varchar(255)
    session varchar(255)
    parent_id varchar(255)
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States derekw

    It seems like the problem is in how the queued track event item is getting created, because the parent id has the placeholder stuff in it instead of a uuid:

    Queued item:

    Array
    (
        [ad_id] => 76612b3d-6072-4a15-83c8-8f6cd7793d88
        [bucket_id] => ad_content
        [values] => Array
            (
                [type] => click
                [parent_id] => AD_TRACK_IMPRESSION_ID_PLACEHOLDER) AND 2680=(SELECT UPPER(XMLType(CHR(60)||CHR(58)||CHR(113)||CHR(113)||CHR(120)||CHR(112)||CHR(113)||(SELECT (CASE WHEN (2680=2680) THEN 1 ELSE 0 END) FROM DUAL)||CHR(113)||CHR(107)||CHR(113)||CHR(106)||CHR(113)||CHR(62))) FROM DUAL) AND (9976=9976
                [ip_address] => 141.98.83.239
                [user_agent] => Mozilla/5.0 (Windows; U; Windows NT 6.1; pl; rv:1.9.1) Gecko/20090624 Firefox/3.5 (.NET CLR 3.5.30729)
                [uuid] => b1aa751b-c7d0-4c25-841e-a5212dcf2976
                [user] => 0
                [ad_id] => 76612b3d-6072-4a15-83c8-8f6cd7793d88
                [session] => 
            )
    
    )
    
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly plach Venezia

    Yes, the placeholder should be replaced with an actual UUID, thatโ€™s the problem. Iโ€™ve had this code running in production for a couple of years now, so I think the storage is fine. I bet the problem is in the parent lookup, for sure we should replace the placeholder with an empty string before replacing it, if no patent is found.

    Iโ€™m wondering whether clicks are happening so quickly that the parent view event is still queued when the click happens, so the table lookup fails.

    We could throw an exception and requeue the item if the parent canโ€™t be found.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States derekw

    Some possible explanations:

    • All my ad block views have Use Ajax enabled.
    • Most of my ad block views are displayed using Slick Carousel.
    • Several of the views are cascading... if no ads match the first view criteria, the No Results action displays a different Ad Block.

    I haven't looked at the impression logic yet but I'm guessing the above factors could be responsible for the placeholder not being replaced.

Production build 0.69.0 2024