Why does postgresql server have a `localhost:57504` to `localhost:57504` UDP “connection”?












1















$ sudo netstat -ap | grep postg
tcp 0 0 localhost:postgresql 0.0.0.0:* LISTEN 1567/postgres
udp 0 0 localhost:57504 localhost:57504 ESTABLISHED 1567/postgres
unix 2 [ ACC ] STREAM LISTENING 27116 1567/postgres /var/run/postgresql/.s.PGSQL.5432


Why does postgresql server have a localhost:57504 to localhost:57504 UDP "connection"? What does that mean?



Thanks.










share|improve this question























  • Fun fact, udp sockets have completely different semantics and behavior than TCP sockets, because UDP is very different than TCP. see man7.org/linux/man-pages/man7/udp.7.html

    – 炸鱼薯条德里克
    5 hours ago











  • Don't trust the remote IP / Port of UDP. As 炸鱼薯条德里克 says, UDP is different. And port 57504 sounds like an Ephemeral Port en.wikipedia.org/wiki/Ephemeral_port You might want to read this : postgresql.org/message-id/21283.1008989228%40sss.pgh.pa.us

    – Philip Couling
    5 hours ago













  • @PhilipCouling Is there some client "connecting" to postgresql server via UDP? I didn't create such client explicitly. Did you mean "that would be the connection to the statistics collector subprocess" in the second link?

    – Tim
    5 hours ago













  • Basically UDP is stateless, any UDP endpoint has its own local address, but no foreign address, unlike connection based TCP, which has an important state called foreign address. Linux support foreign address settings for a UDP socket as a default packet sending target, but you don't have to follow the default.

    – 炸鱼薯条德里克
    3 hours ago













  • TCP connection sockets doesn't support this, it's the abstraction of a TCP connection provided by linux. Once the TCP connection is established, all data has to be send to the exact other endpoint of the connection, it doesn't support real sendto() semantics.

    – 炸鱼薯条德里克
    2 hours ago
















1















$ sudo netstat -ap | grep postg
tcp 0 0 localhost:postgresql 0.0.0.0:* LISTEN 1567/postgres
udp 0 0 localhost:57504 localhost:57504 ESTABLISHED 1567/postgres
unix 2 [ ACC ] STREAM LISTENING 27116 1567/postgres /var/run/postgresql/.s.PGSQL.5432


Why does postgresql server have a localhost:57504 to localhost:57504 UDP "connection"? What does that mean?



Thanks.










share|improve this question























  • Fun fact, udp sockets have completely different semantics and behavior than TCP sockets, because UDP is very different than TCP. see man7.org/linux/man-pages/man7/udp.7.html

    – 炸鱼薯条德里克
    5 hours ago











  • Don't trust the remote IP / Port of UDP. As 炸鱼薯条德里克 says, UDP is different. And port 57504 sounds like an Ephemeral Port en.wikipedia.org/wiki/Ephemeral_port You might want to read this : postgresql.org/message-id/21283.1008989228%40sss.pgh.pa.us

    – Philip Couling
    5 hours ago













  • @PhilipCouling Is there some client "connecting" to postgresql server via UDP? I didn't create such client explicitly. Did you mean "that would be the connection to the statistics collector subprocess" in the second link?

    – Tim
    5 hours ago













  • Basically UDP is stateless, any UDP endpoint has its own local address, but no foreign address, unlike connection based TCP, which has an important state called foreign address. Linux support foreign address settings for a UDP socket as a default packet sending target, but you don't have to follow the default.

    – 炸鱼薯条德里克
    3 hours ago













  • TCP connection sockets doesn't support this, it's the abstraction of a TCP connection provided by linux. Once the TCP connection is established, all data has to be send to the exact other endpoint of the connection, it doesn't support real sendto() semantics.

    – 炸鱼薯条德里克
    2 hours ago














1












1








1








$ sudo netstat -ap | grep postg
tcp 0 0 localhost:postgresql 0.0.0.0:* LISTEN 1567/postgres
udp 0 0 localhost:57504 localhost:57504 ESTABLISHED 1567/postgres
unix 2 [ ACC ] STREAM LISTENING 27116 1567/postgres /var/run/postgresql/.s.PGSQL.5432


Why does postgresql server have a localhost:57504 to localhost:57504 UDP "connection"? What does that mean?



Thanks.










share|improve this question














$ sudo netstat -ap | grep postg
tcp 0 0 localhost:postgresql 0.0.0.0:* LISTEN 1567/postgres
udp 0 0 localhost:57504 localhost:57504 ESTABLISHED 1567/postgres
unix 2 [ ACC ] STREAM LISTENING 27116 1567/postgres /var/run/postgresql/.s.PGSQL.5432


Why does postgresql server have a localhost:57504 to localhost:57504 UDP "connection"? What does that mean?



Thanks.







socket postgresql netstat port






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 5 hours ago









TimTim

27.9k78269486




27.9k78269486













  • Fun fact, udp sockets have completely different semantics and behavior than TCP sockets, because UDP is very different than TCP. see man7.org/linux/man-pages/man7/udp.7.html

    – 炸鱼薯条德里克
    5 hours ago











  • Don't trust the remote IP / Port of UDP. As 炸鱼薯条德里克 says, UDP is different. And port 57504 sounds like an Ephemeral Port en.wikipedia.org/wiki/Ephemeral_port You might want to read this : postgresql.org/message-id/21283.1008989228%40sss.pgh.pa.us

    – Philip Couling
    5 hours ago













  • @PhilipCouling Is there some client "connecting" to postgresql server via UDP? I didn't create such client explicitly. Did you mean "that would be the connection to the statistics collector subprocess" in the second link?

    – Tim
    5 hours ago













  • Basically UDP is stateless, any UDP endpoint has its own local address, but no foreign address, unlike connection based TCP, which has an important state called foreign address. Linux support foreign address settings for a UDP socket as a default packet sending target, but you don't have to follow the default.

    – 炸鱼薯条德里克
    3 hours ago













  • TCP connection sockets doesn't support this, it's the abstraction of a TCP connection provided by linux. Once the TCP connection is established, all data has to be send to the exact other endpoint of the connection, it doesn't support real sendto() semantics.

    – 炸鱼薯条德里克
    2 hours ago



















  • Fun fact, udp sockets have completely different semantics and behavior than TCP sockets, because UDP is very different than TCP. see man7.org/linux/man-pages/man7/udp.7.html

    – 炸鱼薯条德里克
    5 hours ago











  • Don't trust the remote IP / Port of UDP. As 炸鱼薯条德里克 says, UDP is different. And port 57504 sounds like an Ephemeral Port en.wikipedia.org/wiki/Ephemeral_port You might want to read this : postgresql.org/message-id/21283.1008989228%40sss.pgh.pa.us

    – Philip Couling
    5 hours ago













  • @PhilipCouling Is there some client "connecting" to postgresql server via UDP? I didn't create such client explicitly. Did you mean "that would be the connection to the statistics collector subprocess" in the second link?

    – Tim
    5 hours ago













  • Basically UDP is stateless, any UDP endpoint has its own local address, but no foreign address, unlike connection based TCP, which has an important state called foreign address. Linux support foreign address settings for a UDP socket as a default packet sending target, but you don't have to follow the default.

    – 炸鱼薯条德里克
    3 hours ago













  • TCP connection sockets doesn't support this, it's the abstraction of a TCP connection provided by linux. Once the TCP connection is established, all data has to be send to the exact other endpoint of the connection, it doesn't support real sendto() semantics.

    – 炸鱼薯条德里克
    2 hours ago

















Fun fact, udp sockets have completely different semantics and behavior than TCP sockets, because UDP is very different than TCP. see man7.org/linux/man-pages/man7/udp.7.html

– 炸鱼薯条德里克
5 hours ago





Fun fact, udp sockets have completely different semantics and behavior than TCP sockets, because UDP is very different than TCP. see man7.org/linux/man-pages/man7/udp.7.html

– 炸鱼薯条德里克
5 hours ago













Don't trust the remote IP / Port of UDP. As 炸鱼薯条德里克 says, UDP is different. And port 57504 sounds like an Ephemeral Port en.wikipedia.org/wiki/Ephemeral_port You might want to read this : postgresql.org/message-id/21283.1008989228%40sss.pgh.pa.us

– Philip Couling
5 hours ago







Don't trust the remote IP / Port of UDP. As 炸鱼薯条德里克 says, UDP is different. And port 57504 sounds like an Ephemeral Port en.wikipedia.org/wiki/Ephemeral_port You might want to read this : postgresql.org/message-id/21283.1008989228%40sss.pgh.pa.us

– Philip Couling
5 hours ago















@PhilipCouling Is there some client "connecting" to postgresql server via UDP? I didn't create such client explicitly. Did you mean "that would be the connection to the statistics collector subprocess" in the second link?

– Tim
5 hours ago







@PhilipCouling Is there some client "connecting" to postgresql server via UDP? I didn't create such client explicitly. Did you mean "that would be the connection to the statistics collector subprocess" in the second link?

– Tim
5 hours ago















Basically UDP is stateless, any UDP endpoint has its own local address, but no foreign address, unlike connection based TCP, which has an important state called foreign address. Linux support foreign address settings for a UDP socket as a default packet sending target, but you don't have to follow the default.

– 炸鱼薯条德里克
3 hours ago







Basically UDP is stateless, any UDP endpoint has its own local address, but no foreign address, unlike connection based TCP, which has an important state called foreign address. Linux support foreign address settings for a UDP socket as a default packet sending target, but you don't have to follow the default.

– 炸鱼薯条德里克
3 hours ago















TCP connection sockets doesn't support this, it's the abstraction of a TCP connection provided by linux. Once the TCP connection is established, all data has to be send to the exact other endpoint of the connection, it doesn't support real sendto() semantics.

– 炸鱼薯条德里克
2 hours ago





TCP connection sockets doesn't support this, it's the abstraction of a TCP connection provided by linux. Once the TCP connection is established, all data has to be send to the exact other endpoint of the connection, it doesn't support real sendto() semantics.

– 炸鱼薯条德里克
2 hours ago










1 Answer
1






active

oldest

votes


















3














A little bit of digging this is the stats collector. Apparently stats are posted on local loopback (aka localhost) UDP. See here: http://www.neilconway.org/talks/hacking/ottawa/ottawa_slides.pdf . Essentially the different (backend) subprocesses of PostgreSQL are using this UDP port to send statistics to the stats collector. What you are seeing is the "listening" socket waiting to receive messages.



Port 57504 is an Ephemeral port. Meaning nobody picked it, it's randomly assigned at runtime. This is noted here: https://www.postgresql.org/message-id/1273002081.2590.7.camel@w-ehs-psa.telbiomed.at



Note that UDP is very different to TCP because it doesn't care about connections. UDP sockets behave much more like a mailbox; accepting messages from whatever and sending wherever each one is addressed. So the remote host and remote port can often be ignored.



UDP also doesn't care about whether packets are received or not. I suspect that UDP was in part chosen because the backend will never wait for the stats collector even if the stats collector gets flooded.






share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f507578%2fwhy-does-postgresql-server-have-a-localhost57504-to-localhost57504-udp-co%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    A little bit of digging this is the stats collector. Apparently stats are posted on local loopback (aka localhost) UDP. See here: http://www.neilconway.org/talks/hacking/ottawa/ottawa_slides.pdf . Essentially the different (backend) subprocesses of PostgreSQL are using this UDP port to send statistics to the stats collector. What you are seeing is the "listening" socket waiting to receive messages.



    Port 57504 is an Ephemeral port. Meaning nobody picked it, it's randomly assigned at runtime. This is noted here: https://www.postgresql.org/message-id/1273002081.2590.7.camel@w-ehs-psa.telbiomed.at



    Note that UDP is very different to TCP because it doesn't care about connections. UDP sockets behave much more like a mailbox; accepting messages from whatever and sending wherever each one is addressed. So the remote host and remote port can often be ignored.



    UDP also doesn't care about whether packets are received or not. I suspect that UDP was in part chosen because the backend will never wait for the stats collector even if the stats collector gets flooded.






    share|improve this answer






























      3














      A little bit of digging this is the stats collector. Apparently stats are posted on local loopback (aka localhost) UDP. See here: http://www.neilconway.org/talks/hacking/ottawa/ottawa_slides.pdf . Essentially the different (backend) subprocesses of PostgreSQL are using this UDP port to send statistics to the stats collector. What you are seeing is the "listening" socket waiting to receive messages.



      Port 57504 is an Ephemeral port. Meaning nobody picked it, it's randomly assigned at runtime. This is noted here: https://www.postgresql.org/message-id/1273002081.2590.7.camel@w-ehs-psa.telbiomed.at



      Note that UDP is very different to TCP because it doesn't care about connections. UDP sockets behave much more like a mailbox; accepting messages from whatever and sending wherever each one is addressed. So the remote host and remote port can often be ignored.



      UDP also doesn't care about whether packets are received or not. I suspect that UDP was in part chosen because the backend will never wait for the stats collector even if the stats collector gets flooded.






      share|improve this answer




























        3












        3








        3







        A little bit of digging this is the stats collector. Apparently stats are posted on local loopback (aka localhost) UDP. See here: http://www.neilconway.org/talks/hacking/ottawa/ottawa_slides.pdf . Essentially the different (backend) subprocesses of PostgreSQL are using this UDP port to send statistics to the stats collector. What you are seeing is the "listening" socket waiting to receive messages.



        Port 57504 is an Ephemeral port. Meaning nobody picked it, it's randomly assigned at runtime. This is noted here: https://www.postgresql.org/message-id/1273002081.2590.7.camel@w-ehs-psa.telbiomed.at



        Note that UDP is very different to TCP because it doesn't care about connections. UDP sockets behave much more like a mailbox; accepting messages from whatever and sending wherever each one is addressed. So the remote host and remote port can often be ignored.



        UDP also doesn't care about whether packets are received or not. I suspect that UDP was in part chosen because the backend will never wait for the stats collector even if the stats collector gets flooded.






        share|improve this answer















        A little bit of digging this is the stats collector. Apparently stats are posted on local loopback (aka localhost) UDP. See here: http://www.neilconway.org/talks/hacking/ottawa/ottawa_slides.pdf . Essentially the different (backend) subprocesses of PostgreSQL are using this UDP port to send statistics to the stats collector. What you are seeing is the "listening" socket waiting to receive messages.



        Port 57504 is an Ephemeral port. Meaning nobody picked it, it's randomly assigned at runtime. This is noted here: https://www.postgresql.org/message-id/1273002081.2590.7.camel@w-ehs-psa.telbiomed.at



        Note that UDP is very different to TCP because it doesn't care about connections. UDP sockets behave much more like a mailbox; accepting messages from whatever and sending wherever each one is addressed. So the remote host and remote port can often be ignored.



        UDP also doesn't care about whether packets are received or not. I suspect that UDP was in part chosen because the backend will never wait for the stats collector even if the stats collector gets flooded.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 5 hours ago

























        answered 5 hours ago









        Philip CoulingPhilip Couling

        1,964920




        1,964920






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f507578%2fwhy-does-postgresql-server-have-a-localhost57504-to-localhost57504-udp-co%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            サソリ

            広島県道265号伴広島線

            Setup Asymptote in Texstudio