jetty.project icon indicating copy to clipboard operation
jetty.project copied to clipboard

after I stop Jetty with `ctrl+c`, the ports, are not killed.

Open fgolzari opened this issue 1 year ago • 3 comments
trafficstars

Jetty Version 12 Jetty Environment ee10

Java Version 21 Question After asking a lot of questions from your work team, the command for deploy the project was executed without error. But now I have this problems: In the project deployment process, I left a module that was written in the previous version of Jetty (Jetty 9) in this version as well, and its contents are as follows:

setuid.mod

# Set UID Feature  
[depend]  
server  

[lib]  
lib/setuid/jetty-setuid-jna-2.0.2.jar  
lib/setuid/jna-5.14.0.jar  

[xml]  
etc/jetty-setuid.xml  

[ini-template]  
1mtpBindAddress=  
1mtpBindPort=7012  
1mtpServerEnabled=true  
pop3ServerEnabled=true  
pop3BindAddress=  
pop3BindPort=7121  
pop3SSLServerEnabled=true  
pop3SSLBindAddress=  
pop3SSLBindPort=7920  
imapServerEnabled=true  
imapBindAddress=  
imapBindPort=7111  
imapSSLServerEnabled=true  
imapSSLBindAddress=  
imapSSLBindPort=7922  
sSLExcludeCipherSuites=.* RC4_.*  
sSLIncludeCipherSuites=  
mailboxdSSLProtocols=SSLv2Hello TLSv1 TLSv1.1 TLSv1.2  
nio_imap_enabled=true  
mailboxd_keystore=/opt/chmail/mailboxd/etc/keystore  
mailboxd_keystore_password=5U  
mailboxd_truststore_password=ch  
uid=998  
gid=998

$jetty_base/etc/jetty-setuid.xml

<?xml version="1.0"?>  
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/Jetty/configure 10 0.dtd">  
<!-- Configure the Jetty SetUIDListener -->  
<Configure id="Server" class="org.eclipse.jetty.server.Server">  
    <Call class="com.chmail.common.handler.PrivilegedHandler" name="openPorts">  
        <Arg>  
            <Map>  
                <Entry>  
                    <Item>lmtpBindAddress</Item>  
                    <Item><New class="java.lang.String"><Arg><Property name="lmtpBindAddress" default=""/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>lmtpBindPort</Item>  
                    <Item><New class="java.lang.Integer"><Arg><Property name="lmtpBindPort" default="7025"/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>imapServerEnabled</Item>  
                    <Item><New class="java.lang.Boolean"><Arg><Property name="imapServerEnabled" default="false"/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>lmtpServerEnabled</Item>  
                    <Item><New class="java.lang.Boolean"><Arg><Property name="lmtpServerEnabled" default="false"/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>imapBindAddress</Item>  
                    <Item><New class="java.lang.String"><Arg><Property name="imapBindAddress" default=""/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>imapBindPort</Item>  
                    <Item><New class="java.lang.Integer"><Arg><Property name="imapBindPort" default="143"/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>imapSSLServerEnabled</Item>  
                    <Item><New class="java.lang.Boolean"><Arg><Property name="imapSSLServerEnabled" default="false"/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>imapSSLBindAddress</Item>  
                    <Item><New class="java.lang.String"><Arg><Property name="imapSSLBindAddress" default=""/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>imapSSLBindPort</Item>  
                    <Item><New class="java.lang.Integer"><Arg><Property name="imapSSLBindPort" default="993"/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>pop3ServerEnabled</Item>  
                    <Item><New class="java.lang.Boolean"><Arg><Property name="pop3ServerEnabled" default="false"/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>pop3BindAddress</Item>  
                    <Item><New class="java.lang.String"><Arg><Property name="pop3BindAddress" default=""/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>pop3BindPort</Item>  
                    <Item><New class="java.lang.Integer"><Arg><Property name="pop3BindPort" default="110"/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>pop3SSLServerEnabled</Item>  
                    <Item><New class="java.lang.Boolean"><Arg><Property name="pop3SSLServerEnabled" default="false"/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>pop3SSLBindAddress</Item>  
                    <Item><New class="java.lang.String"><Arg><Property name="pop3SSLBindAddress" default=""/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>pop3SSLBindPort</Item>  
                    <Item><New class="java.lang.Integer"><Arg><Property name="pop3SSLBindPort" default="995"/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>sslExcludeCipherSuites</Item>  
                    <Item><New class="java.lang.String"><Arg><Property name="sslExcludeCipherSuites" default=""/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>sslIncludeCipherSuites</Item>  
                    <Item><New class="java.lang.String"><Arg><Property name="sslIncludeCipherSuites" default=""/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>mailboxdSSLProtocols</Item>  
                    <Item><New class="java.lang.String"><Arg><Property name="mailboxdSSLProtocols" default=""/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>nio_imap_enabled</Item>  
                    <Item><New class="java.lang.Boolean"><Arg><Property name="nio_imap_enabled" default="false"/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                    <Item>mailboxd_keystore</Item>  
                    <Item><New class="java.lang.String"><Arg><Property name="mailboxd_keystore" default="/opt/chmail/jetty/etc/keystore"/></Arg></New></Item>  
                </Entry>  
                <Entry>  
                        <Item>mailboxd_keystore_password</Item>  
                        <Item>  
                            -<New class="java.lang.String">  
                                <Arg>  
                                    <Property name="mailboxd_keystore_password" default="" />  
                                </Arg>  
                            </New>  
                        </Item>  
                    </Entry>  
                    <Entry>  
                        <Item>mailboxd_truststore_password</Item>  
                        <Item>  
                            -<New class="java.lang.String">  
                                <Arg>  
                                    <Property name="mailboxd_truststore_password" default="" />  
                                </Arg>  
                            </New>  
                        </Item>  
                    </Entry>  
      </Map>  
      </Arg>  
      </Call>  
    <Call name="addEventListener">  
        <Arg>  
            <New class="org.eclipse.jetty.setuid.SetUIDListener">  
                <Set name="startServerAsPrivileged">  
                    <Property name="jetty.setuid.startServerAsPrivileged" default="false" />  
                </Set>  
                <Set name="umaskOctal">23</Set>  
                <Set name="username">ch</Set>  
                <Set name="groupname">ch</Set>  
                <Set name="clearSupplementalGroups">  
                    <Property name="jetty.setuid.clearSupplementalGroups" default="false" />  
                </Set>  
                <!-- uncomment to change the limits on number of open file descriptors for root -->  
                <Call name="setRLimitNoFiles">  
                    <Arg>  
                        <New class="org.eclipse.jetty.setuid.RLimit">  
                            <Set name="soft">65536</Set>  
                            <Set name="hard">65536</Set>  
                        </New>  
                    </Arg>  
                </Call>  
            </New>  
        </Arg>  
    </Call> 

Now after I stop Jetty with ctrl+c, these ports are configed in [init-template] of setuid.mod , are not killed.

i have set jetty.serve.stopatshutdown= true

fgolzari avatar Aug 03 '24 13:08 fgolzari

This does not look like a Jetty problem.

Your custom code is probably not closing the ports that it opens.

sbordet avatar Aug 03 '24 13:08 sbordet

@sbordet In the Jetty configs itself, is there no option to set Jetty to close all the ports it has opened when it stops?

fgolzari avatar Aug 03 '24 19:08 fgolzari

What ports are not closed?

Jetty closes all the ports it opens.

sbordet avatar Aug 03 '24 19:08 sbordet

This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Aug 22 '25 00:08 github-actions[bot]

Closing, not enough information and no follow up.

sbordet avatar Aug 22 '25 16:08 sbordet