You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hawq.apache.org by realdawn <gi...@git.apache.org> on 2016/03/03 05:50:17 UTC

[GitHub] incubator-hawq pull request: HAWQ-483. Fix bug for Error in debug1...

GitHub user realdawn opened a pull request:

    https://github.com/apache/incubator-hawq/pull/406

    HAWQ-483. Fix bug for Error in debug1 state.

    "serializedIdentity" doesn't include '\0', which will cause core dump in SetupProcessIdentity() with using elog(DEBUG1).
    So palloc a new string with '\0'.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/realdawn/incubator-hawq HAWQ-483

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-hawq/pull/406.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #406
    
----
commit 9ce584e2cf358e1c68b4d15f851567dd93532c56
Author: doli <do...@pivotal.io>
Date:   2016-03-03T04:47:33Z

    HAWQ-483. Fix bug for Error in debug1 state.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq pull request: HAWQ-483. Fix bug for Error in debug1...

Posted by realdawn <gi...@git.apache.org>.
Github user realdawn commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/406#discussion_r54843454
  
    --- Diff: src/backend/tcop/postgres.c ---
    @@ -4880,7 +4881,18 @@ PostgresMain(int argc, char *argv[], const char *username)
     						SetUserIdAndContext(cuid, false); /* Set current userid */
     
     					if (serializedIdentityLen > 0)
    +					{
    +						/*
    +						 * serializedIdentity doesn't include '\0', which will cause core dump in SetupProcessIdentity() with using elog(DEBUG1).
    +						 * So palloc a new string with '\0'.
    +						 */
    +						completeSerializedIdentity = (char *) palloc((serializedIdentityLen + 1) * sizeof(char) );
    +						memcpy(completeSerializedIdentity, serializedIdentity, serializedIdentityLen);
    +						completeSerializedIdentity[serializedIdentityLen] = '\0';
    +						serializedIdentity = completeSerializedIdentity;
     						SetupProcessIdentity(serializedIdentity);
    --- End diff --
    
    As the MemoryContext which is MessageContext will reset every time, so it will not cause memory leak even it  errors. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq pull request: HAWQ-483. Fix bug for Error in debug1...

Posted by ictmalili <gi...@git.apache.org>.
Github user ictmalili commented on the pull request:

    https://github.com/apache/incubator-hawq/pull/406#issuecomment-191595247
  
    I think it's better to put the code inside function SetupProcessIdentity, instead of putting it in the PostgresMain, since the function already takes up so many lines.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq pull request: HAWQ-483. Fix bug for Error in debug1...

Posted by huor <gi...@git.apache.org>.
Github user huor commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/406#discussion_r54839613
  
    --- Diff: src/backend/tcop/postgres.c ---
    @@ -4880,7 +4881,18 @@ PostgresMain(int argc, char *argv[], const char *username)
     						SetUserIdAndContext(cuid, false); /* Set current userid */
     
     					if (serializedIdentityLen > 0)
    +					{
    +						/*
    +						 * serializedIdentity doesn't include '\0', which will cause core dump in SetupProcessIdentity() with using elog(DEBUG1).
    +						 * So palloc a new string with '\0'.
    +						 */
    +						completeSerializedIdentity = (char *) palloc((serializedIdentityLen + 1) * sizeof(char) );
    +						memcpy(completeSerializedIdentity, serializedIdentity, serializedIdentityLen);
    +						completeSerializedIdentity[serializedIdentityLen] = '\0';
    +						serializedIdentity = completeSerializedIdentity;
     						SetupProcessIdentity(serializedIdentity);
    --- End diff --
    
    Here pfree only handle the situation when SetupProcessIdentity successfully compltes. We also need to do the pfree if it errors in SetupProcessIdentity.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq pull request: HAWQ-483. Fix bug for Error in debug1...

Posted by ictmalili <gi...@git.apache.org>.
Github user ictmalili commented on the pull request:

    https://github.com/apache/incubator-hawq/pull/406#issuecomment-191592877
  
    Looks good to me. +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq pull request: HAWQ-483. Fix bug for Error in debug1...

Posted by realdawn <gi...@git.apache.org>.
Github user realdawn commented on the pull request:

    https://github.com/apache/incubator-hawq/pull/406#issuecomment-191621814
  
    If I put the code into function SetupProcessIdentity, I must put serializedIdentityLen into the function which will change the function interface. So I just make the minimal change. 



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq pull request: HAWQ-483. Fix bug for Error in debug1...

Posted by realdawn <gi...@git.apache.org>.
Github user realdawn closed the pull request at:

    https://github.com/apache/incubator-hawq/pull/406


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---