Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-11366

ArmHF SIGBUS errors in Connect Storage Engine

Details

    Description

      While building and testing on Launchpad, MariaDB crashes with SIGBUS in the connect storage engine when working with doubles as data, in a TABLE_FORMAT=BIN table.
      The test that fails is connect.upd.

      Sadly, no stack trace is available, however the common error message is:

      161113  0:19:49 [ERROR] mysqld got signal 7 ;
      

      NOTE: ArmHF requires memory alignment of 8 for 64 bit double values.

      The problem is fixed on Launchpad via this patch:
      https://github.com/cvicentiu/mariadb-10.0/commit/9e44ef13086672f2e852cd2ad6ae3ed658f999dd

      Attachments

        Issue Links

          Activity

            cvicentiu Vicențiu Ciorbaru created issue -
            cvicentiu Vicențiu Ciorbaru made changes -
            Field Original Value New Value
            Labels foundation
            cvicentiu Vicențiu Ciorbaru added a comment - - edited

            MDEV-11367 is the same type of bug, different place in the code

            cvicentiu Vicențiu Ciorbaru added a comment - - edited MDEV-11367 is the same type of bug, different place in the code
            cvicentiu Vicențiu Ciorbaru made changes -
            cvicentiu Vicențiu Ciorbaru made changes -
            Description While building and testing on Launchpad, MariaDB crashes with SIGBUS in the connect storage engine when working with doubles as data, in a TABLE_FORMAT=BIN table.
            The test that fails is connect.upd.

            NOTE: ArmHF requires memory alignment of 8 for 64 bit double values.

            The problem is fixed on Debian via this patch:
            https://github.com/cvicentiu/mariadb-10.0/commit/9e44ef13086672f2e852cd2ad6ae3ed658f999dd
            While building and testing on Launchpad, MariaDB crashes with SIGBUS in the connect storage engine when working with doubles as data, in a TABLE_FORMAT=BIN table.
            The test that fails is connect.upd.

            NOTE: ArmHF requires memory alignment of 8 for 64 bit double values.

            The problem is fixed on Launchpad via this patch:
            https://github.com/cvicentiu/mariadb-10.0/commit/9e44ef13086672f2e852cd2ad6ae3ed658f999dd
            cvicentiu Vicențiu Ciorbaru made changes -
            Description While building and testing on Launchpad, MariaDB crashes with SIGBUS in the connect storage engine when working with doubles as data, in a TABLE_FORMAT=BIN table.
            The test that fails is connect.upd.

            NOTE: ArmHF requires memory alignment of 8 for 64 bit double values.

            The problem is fixed on Launchpad via this patch:
            https://github.com/cvicentiu/mariadb-10.0/commit/9e44ef13086672f2e852cd2ad6ae3ed658f999dd
            While building and testing on Launchpad, MariaDB crashes with SIGBUS in the connect storage engine when working with doubles as data, in a TABLE_FORMAT=BIN table.
            The test that fails is connect.upd.

            Sadly, no stack trace is available, however the common error message is:
            {noformat}
            161113 0:19:49 [ERROR] mysqld got signal 7 ;
            {noformat}

            NOTE: ArmHF requires memory alignment of 8 for 64 bit double values.

            The problem is fixed on Launchpad via this patch:
            https://github.com/cvicentiu/mariadb-10.0/commit/9e44ef13086672f2e852cd2ad6ae3ed658f999dd

            I have seen your patch. However, because can be a performance increase, I'd like to make it conditional:

            1. Is it only required for double values?
            2. can a ArmHF be tested in #if conditions?

            Thanks.

            bertrandop Olivier Bertrand added a comment - I have seen your patch. However, because can be a performance increase, I'd like to make it conditional: Is it only required for double values? can a ArmHF be tested in #if conditions? Thanks.
            cvicentiu Vicențiu Ciorbaru added a comment - - edited

            For #1: This concerns more than ArmHF unfortunately. We need to check with every platform what kind of restrictions it imposes. Also, it happens with longlong values as well I think, but testing it was very tricky. Check the related MDEV-11367. That patch replaces a longlong pointer dereference.
            For #2: Yes

            I know that this matter is concerning performance wise, but I'd really want to test this instead of relying on brittle code. It might be that compilers are smart enough to transform memcpy into a pointer dereference anyway.

            I can try a micro benchmark to see if this impacts performance or not, but the caveat is that it might not give the full picture depending on various compilers.

            cvicentiu Vicențiu Ciorbaru added a comment - - edited For #1: This concerns more than ArmHF unfortunately. We need to check with every platform what kind of restrictions it imposes. Also, it happens with longlong values as well I think, but testing it was very tricky. Check the related MDEV-11367 . That patch replaces a longlong pointer dereference. For #2: Yes I know that this matter is concerning performance wise, but I'd really want to test this instead of relying on brittle code. It might be that compilers are smart enough to transform memcpy into a pointer dereference anyway. I can try a micro benchmark to see if this impacts performance or not, but the caveat is that it might not give the full picture depending on various compilers.

            I know, the same kind of patch is also needed for MIPS platforms but for all numerical types, not only doubles.

            bertrandop Olivier Bertrand added a comment - I know, the same kind of patch is also needed for MIPS platforms but for all numerical types, not only doubles.

            I didn't know about that. Can you link it somehow? Where is it applied? I'm slightly worried that my patch is not complete. I think there are more potential pointer dereferences in the Connect Storage engine but I did not spend too much time to understand the surrounding logic.

            cvicentiu Vicențiu Ciorbaru added a comment - I didn't know about that. Can you link it somehow? Where is it applied? I'm slightly worried that my patch is not complete. I think there are more potential pointer dereferences in the Connect Storage engine but I did not spend too much time to understand the surrounding logic.

            There has been a discussion about such problems with MIPS and a proposed patch that was not correct. Looking into the code, I discover another patch that was made by I don't know who, but that I am going to test because it may not be correct in some cases.

            The key places to look at are in tabfix.cpp from line 471 and the patch is in value.h line 127.

            bertrandop Olivier Bertrand added a comment - There has been a discussion about such problems with MIPS and a proposed patch that was not correct. Looking into the code, I discover another patch that was made by I don't know who, but that I am going to test because it may not be correct in some cases. The key places to look at are in tabfix.cpp from line 471 and the patch is in value.h line 127.
            bertrandop Olivier Bertrand made changes -
            Assignee Vicentiu Ciorbaru [ cvicentiu ] Olivier Bertrand [ bertrandop ]

            Vicentiu: I applied your patch plus some more fixes concerning writing in BIN table files.

            However this was tested on my machine and on buildbot machines only and apparently none of them have CPU requiring alignment.

            So please test if my fixes really work when the new versions will be released and reopen this case if not. Thanks.

            bertrandop Olivier Bertrand added a comment - Vicentiu: I applied your patch plus some more fixes concerning writing in BIN table files. However this was tested on my machine and on buildbot machines only and apparently none of them have CPU requiring alignment. So please test if my fixes really work when the new versions will be released and reopen this case if not. Thanks.
            bertrandop Olivier Bertrand made changes -
            issue.field.resolutiondate 2016-12-02 23:01:55.0 2016-12-02 23:01:55.775
            bertrandop Olivier Bertrand made changes -
            Fix Version/s 10.0.29 [ 22312 ]
            Fix Version/s 10.1.20 [ 22112 ]
            Fix Version/s 10.2.3 [ 22115 ]
            Fix Version/s 10.0 [ 16000 ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 78470 ] MariaDB v4 [ 151266 ]

            People

              bertrandop Olivier Bertrand
              cvicentiu Vicențiu Ciorbaru
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.