Re: [HACKERS] attaching a process in eclipse

2014-12-28 Thread Craig Ringer
On 12/28/2014 06:37 PM, Ravi Kiran wrote:
 
 Could not attach to process.  If your uid matches the uid of the target
 process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
 again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
 
 how do we rectify this error?

At a guess, the PostgreSQL you are trying to attach to is not running
under the same user account as Eclipse.

The Linux kernel only permits you to attach to a process with the same
user account as you by default, unless you are the root user. That's
what if your uid matches the uid of the target process refers to.

You'll have the same issue when attaching using gdb directly, this isn't
an Eclipse issue.

If you were debugging manually with gdb you'd often do something like

sudo -u postgres gdb -p thepid

to run gdb as the same user id as the target process. (Avoid running gdb
as root whenever possible). Perhaps Eclipse lets you configure a prefix
command for gdb so you can do that with Eclipse and passwordless sudo?

-- 
 Craig Ringer   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training  Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] attaching a process in eclipse

2014-12-28 Thread Craig Ringer
On 12/28/2014 06:37 PM, Ravi Kiran wrote:
 
 Could not attach to process.  If your uid matches the uid of the target
 process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
 again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
 
 how do we rectify this error?

Oh, and if you *are* debugging a PostgreSQL process under the same uid
as your own, adjust the ptrace_scope i the yama security module. Like
the error message above tells you to.

Details here:
http://askubuntu.com/questions/41629/after-upgrade-gdb-wont-attach-to-process
which I found by *searching for the error message text*.

BTW, in general I recommend that when you're modifying and debugging
PostgreSQL you run it under your normal user account using 'postgres' or
'pg_ctl', rather than messing with an operating system installation.
It's much easier.

-- 
 Craig Ringer   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training  Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] attaching a process in eclipse

2014-12-28 Thread Craig Ringer
On 12/28/2014 07:49 PM, Ravi Kiran wrote:
 Thank you for the response sir, I am running both the eclipse and the
 client under the same user name which is ravi, I have installed postgres
 source code under the user ravi not postgres,

It doesn't matter how you installed it. How you *run* it matters. If the
postgresql processes run as user 'ravi' and so does Eclipse, then your
problem is the one in the article I already sent you a link to, and you
should follow those instructions.

 should I change it and
 work under postgres

No. If you read my explanation you would understand that this would just
make it worse, because you can't attach to a process under a different
user id.

 and for that to happen should I uninstall the whole
 postgres and re install under the new user postgres.

That won't help.

By the way, it looks like you also posted this to Stack Overflow:

http://stackoverflow.com/q/27676836/398670

It's OK to do that, but *please mention you posted somewhere else too*
or preferably link to the relevant article in the mailing list archives.

Also, when replying to mail on a list, please reply-to-all.

-- 
 Craig Ringer   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training  Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] attaching a process in eclipse

2014-12-28 Thread Ravi Kiran
Sir, I followed the instructions in the link which you gave , but this time
I am getting the following error.

*Can't find a source file at
/build/buildd/eglibc-2.19/socket/../sysdeps/unix/sysv/linux/x86_64/recv.c *
*Locate the file or edit the source lookup path to include its location.*

is the error something related my OS or is it related to postgres.


Thank you for telling the mistake, I will follow the things which you told
from the next time.

Thank you

On Sun, Dec 28, 2014 at 7:36 PM, Craig Ringer cr...@2ndquadrant.com wrote:

 On 12/28/2014 07:49 PM, Ravi Kiran wrote:
  Thank you for the response sir, I am running both the eclipse and the
  client under the same user name which is ravi, I have installed postgres
  source code under the user ravi not postgres,

 It doesn't matter how you installed it. How you *run* it matters. If the
 postgresql processes run as user 'ravi' and so does Eclipse, then your
 problem is the one in the article I already sent you a link to, and you
 should follow those instructions.

  should I change it and
  work under postgres

 No. If you read my explanation you would understand that this would just
 make it worse, because you can't attach to a process under a different
 user id.

  and for that to happen should I uninstall the whole
  postgres and re install under the new user postgres.

 That won't help.

 By the way, it looks like you also posted this to Stack Overflow:

 http://stackoverflow.com/q/27676836/398670

 It's OK to do that, but *please mention you posted somewhere else too*
 or preferably link to the relevant article in the mailing list archives.

 Also, when replying to mail on a list, please reply-to-all.

 --
  Craig Ringer   http://www.2ndQuadrant.com/
  PostgreSQL Development, 24x7 Support, Training  Services



Re: [HACKERS] attaching a process in eclipse

2014-12-28 Thread Craig Ringer
On 12/28/2014 10:18 PM, Ravi Kiran wrote:
 Sir, I followed the instructions in the link which you gave , but this
 time I am getting the following error.
 
 *Can't find a source file at
 /build/buildd/eglibc-2.19/socket/../sysdeps/unix/sysv/linux/x86_64/recv.c *
 *Locate the file or edit the source lookup path to include its location.*
 *
 *
 is the error something related my OS or is it related to postgres. 

I think it's best to discuss this somewhere other than pgsql-hackers, as
this discussion isn't going to be of interest to the majority of people
on this mailing list. What you're asking about now isn't really anything
to do with PostgreSQL at all.

I replied to your Stack Overflow post at
http://stackoverflow.com/q/27676836/398670 .

-- 
 Craig Ringer   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training  Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers