Address already in use

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

steve13627
Posts: 50
Joined: 06 Dec 2016, 06:27

Address already in use

Postby steve13627 » 18 Aug 2017, 05:55

Hi admin side, I want to run two SFS2x instance in same server, I've changed the port by refering the http://smartfoxserver.com/blog/running-two-sfs2x-instances-on-the-same-machine/.But still got the error as below:

Code: Select all

Exception: java.net.BindException
Message: Address already in use
Description: The specified TCP port cannot be bound to the configured IP address.
Possible Causes: Probably you are running another instance of SFS2X. Please double check using the AdminTool.
Start a new browser page at http://<your-sfs-domain>/admin/
If the problem persists, email us the content of this error message to support[at]smartfoxserver.com
+--- --- ---+
Stack Trace:
+--- --- ---+
sun.nio.ch.Net.bind0(Native Method)
sun.nio.ch.Net.bind(Unknown Source)
sun.nio.ch.Net.bind(Unknown Source)
sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:216)
org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:315)
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
org.mortbay.jetty.Server.doStart(Server.java:235)
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
com.smartfoxserver.v2.http.SFSHttpServer.start(SFSHttpServer.java:111)
com.smartfoxserver.v2.SmartFoxServer.start(SmartFoxServer.java:250)
com.smartfoxserver.v2.Main.main(Main.java:31)

Btw,the two instance are different version, the one is "2.13", the older one is "2.X".

There is a part of server.xml from version "2.13"

Code: Select all

serverSettings>
  <socketAddresses>
    <socket address="0.0.0.0" port="9934" type="TCP"/>
    <socket address="127.0.0.1" port="9934" type="UDP"/>
  </socketAddresses>
  <ipFilter>
    <addressBlackList>
      <string>1.2.3.4</string>
    </addressBlackList>
    <addressWhiteList>
      <string>127.0.0.1</string>
    </addressWhiteList>
    <maxConnectionsPerAddress>9999999</maxConnectionsPerAddress>
  </ipFilter>
  <flashCrossdomainPolicy>
    <useMasterSocketPolicy>true</useMasterSocketPolicy>
    <policyXmlFile>crossdomain.xml</policyXmlFile>
  </flashCrossdomainPolicy>
  <systemControllerRequestQueueSize>20000</systemControllerRequestQueueSize>
  <extensionControllerRequestQueueSize>20000</extensionControllerRequestQueueSize>
  <schedulerThreadPoolSize>4</schedulerThreadPoolSize>
  <protocolCompressionThreshold>1024</protocolCompressionThreshold>
  <protocolMode>BINARY</protocolMode>
  <useBinaryProtocol>true</useBinaryProtocol>
  <remoteAdmin>
    <administrators>
      <adminUser>
        <login>sfsadmin</login>
      </adminUser>
    </administrators>
    <allowedRemoteAddresses>
    </allowedRemoteAddresses>
    <adminTcpPort>9934</adminTcpPort>
    <useEncryption>false</useEncryption>
  </remoteAdmin>


"server.xml" from version "2.X"

Code: Select all

<serverSettings>
  <socketAddresses>
    <socket address="10.55.200.126" port="9339" type="TCP"/>
    <socket address="10.55.200.126" port="9339" type="UDP"/>
  </socketAddresses>
  <ipFilter>
    <addressBlackList>
      <string>1.2.3.4</string>
    </addressBlackList>
    <addressWhiteList>
      <string>127.0.0.1</string>
    </addressWhiteList>
    <maxConnectionsPerAddress>9999999</maxConnectionsPerAddress>
  </ipFilter>
  <flashCrossdomainPolicy>
    <useMasterSocketPolicy>true</useMasterSocketPolicy>
    <policyXmlFile>crossdomain.xml</policyXmlFile>
  </flashCrossdomainPolicy>
  <systemControllerThreadPoolSize>1</systemControllerThreadPoolSize>
  <extensionControllerThreadPoolSize>30</extensionControllerThreadPoolSize>
  <systemControllerRequestQueueSize>20000</systemControllerRequestQueueSize>
  <extensionControllerRequestQueueSize>20000</extensionControllerRequestQueueSize>
  <schedulerThreadPoolSize>5</schedulerThreadPoolSize>
  <protocolCompressionThreshold>1024</protocolCompressionThreshold>
  <protocolMode>BINARY</protocolMode>
  <useBinaryProtocol>true</useBinaryProtocol>
  <remoteAdmin>
    <administrators>
      <adminUser>
        <login>sfsadmin</login>
      </adminUser>
    </administrators>
    <allowedRemoteAddresses/>
    <adminTcpPort>9339</adminTcpPort>
  </remoteAdmin>



Please let me know if there is any clarification. Thank you very much.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Address already in use

Postby Lapo » 18 Aug 2017, 07:28

Hi,
if you're using SFS2X 2.13 HTTPS is also active by default so you will need to use two different ports for that service as well.
Default is 8443 so you can assign any other valid value to the 2nd instance, e.g. 8444

Hope it helps.
Lapo
--
gotoAndPlay()
...addicted to flash games
steve13627
Posts: 50
Joined: 06 Dec 2016, 06:27

Re: Address already in use

Postby steve13627 » 18 Aug 2017, 09:27

Thank for your help, could you tell me in which config file I can modify it?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Address already in use

Postby Lapo » 18 Aug 2017, 09:44

Well, the easiest way is to use the AdminTool.
Make sure you just have one server running, log in with the AdminTool and edit the ports under Server Configurator > Web Server.
Then save and restart SFS2X.

Otherwise you'll need to edit SFS2X/lib/jetty/start.d/ssl.ini

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
steve13627
Posts: 50
Joined: 06 Dec 2016, 06:27

Re: Address already in use

Postby steve13627 » 21 Aug 2017, 02:40

I can't login the admin tool even if there is only one instance is runing, so I change the file as your guide, but the problem is persistent. Do you need some more other information to slove this problem? If yes, please let me know.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Address already in use

Postby Lapo » 21 Aug 2017, 07:41

What error do you see when the Admin login fails?
Also keep in mind that the server config allows you specify a custom port for the AdminTool. Maybe you've changed that in your config?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
steve13627
Posts: 50
Joined: 06 Dec 2016, 06:27

Re: Address already in use

Postby steve13627 » 21 Aug 2017, 08:51

I jsut modified the Port value in server.xml as below. After typing the username and passord, got failed to connect ! Please refer the attachment screenshot

Code: Select all

<serverSettings>
  <socketAddresses>
    <socket address="0.0.0.0" port="9934" type="TCP"/>
    <socket address="127.0.0.1" port="9934" type="UDP"/>
  </socketAddresses>
  <ipFilter>
    <addressBlackList>
      <string>1.2.3.4</string>
    </addressBlackList>
    <addressWhiteList>
      <string>127.0.0.1</string>
    </addressWhiteList>
    <maxConnectionsPerAddress>9999999</maxConnectionsPerAddress>
  </ipFilter>
  <flashCrossdomainPolicy>
    <useMasterSocketPolicy>true</useMasterSocketPolicy>
    <policyXmlFile>crossdomain.xml</policyXmlFile>
  </flashCrossdomainPolicy>
  <systemControllerRequestQueueSize>20000</systemControllerRequestQueueSize>
  <extensionControllerRequestQueueSize>20000</extensionControllerRequestQueueSize>
  <schedulerThreadPoolSize>4</schedulerThreadPoolSize>
  <protocolCompressionThreshold>1024</protocolCompressionThreshold>
  <protocolMode>BINARY</protocolMode>
  <useBinaryProtocol>true</useBinaryProtocol>
  <remoteAdmin>
    <administrators>
      <adminUser>
        <login>sfsadmin</login>
        <password>sfsadmin</password>
      </adminUser>
    </administrators>
    <allowedRemoteAddresses>
    </allowedRemoteAddresses>
    <adminTcpPort>9934</adminTcpPort>
    <useEncryption>false</useEncryption>
  </remoteAdmin>
  <bannedUserManager>
    <isAutoRemove>true</isAutoRemove>
    <isPersistent>true</isPersistent>
    <customPersistenceClass></customPersistenceClass>
  </bannedUserManager>
  <extensionRemoteDebug>true</extensionRemoteDebug>
  <useFriendlyExceptions>true</useFriendlyExceptions>
  <mailer>
    <isActive>false</isActive>
    <mailHost>your.smtp.here</mailHost>
    <mailUser>username</mailUser>
    <mailPass>password</mailPass>
    <smtpPort>25</smtpPort>
    <workerThreads>1</workerThreads>
  </mailer>
  <webServer>
    <isActive>true</isActive>
    <blueBoxPollingTimeout>26</blueBoxPollingTimeout>
    <blueBoxMsgQueueSize>40</blueBoxMsgQueueSize>
        <isWSActive>false</isWSActive>
        <useWSBinaryProtocol>true</useWSBinaryProtocol>
  </webServer>
  <analytics>
    <isActive>false</isActive>
    <runOnDay>[everyday]</runOnDay>
    <runAtHour>2</runAtHour>
    <runOnStartup>false</runOnStartup>
    <rebuildDB>false</rebuildDB>
    <skipGeolocation>false</skipGeolocation>
    <sourceFolder></sourceFolder>
    <locale></locale>
  </analytics>
 <systemThreadPoolSettings>
   <name>Sys</name>
   <coreThreads>4</coreThreads>
   <backupThreads>16</backupThreads>
   <maxBackups>64</maxBackups>
   <queueSizeTriggeringBackup>100</queueSizeTriggeringBackup>
   <secondsTriggeringBackup>50</secondsTriggeringBackup>
   <backupThreadsExpiry>3600</backupThreadsExpiry>
   <queueSizeTriggeringBackupExpiry>60</queueSizeTriggeringBackupExpiry>
   <logActivity>true</logActivity>
   <queueFullWarningInterval>300</queueFullWarningInterval>
 </systemThreadPoolSettings>
 <extensionThreadPoolSettings>
   <name>Ext</name>
   <coreThreads>4</coreThreads>
   <backupThreads>16</backupThreads>
   <maxBackups>64</maxBackups>
   <queueSizeTriggeringBackup>100</queueSizeTriggeringBackup>
   <secondsTriggeringBackup>50</secondsTriggeringBackup>
   <backupThreadsExpiry>3600</backupThreadsExpiry>
   <queueSizeTriggeringBackupExpiry>60</queueSizeTriggeringBackupExpiry>
   <logActivity>true</logActivity>
   <queueFullWarningInterval>300</queueFullWarningInterval>
 </extensionThreadPoolSettings>
  <startExtensionFileMonitor>true</startExtensionFileMonitor>
  <useDebugMode>true</useDebugMode>
  <sessionMaxIdleTime>30</sessionMaxIdleTime>
  <userMaxIdleTime>300</userMaxIdleTime>
  <licenseCode></licenseCode>
  <licenseEmails></licenseEmails>
  <ghostHunterEnabled>true</ghostHunterEnabled>
  <statsExtraLoggingEnabled>true</statsExtraLoggingEnabled>
</serverSettings>
Attachments
QQ图片20170821165908.png
(3.88 KiB) Not downloaded yet
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Address already in use

Postby Lapo » 21 Aug 2017, 09:27

For starters I would recommend you immediately change your admin password since you have posted all your config and IP address here! :wink:

The problem is that port 9934 appears to be closed, probably because you need to configure your firewall to allow traffic in both directions.
Other than that your config looks good.
Lapo

--

gotoAndPlay()

...addicted to flash games
steve13627
Posts: 50
Joined: 06 Dec 2016, 06:27

Re: Address already in use

Postby steve13627 » 21 Aug 2017, 10:00

oK,leave it,it's the temporary server, I will remove it soon. Can we go back to the last topic" How to run two intance in one server?" :)
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Address already in use

Postby Lapo » 21 Aug 2017, 10:34

steve13627 wrote:oK,leave it,it's the temporary server, I will remove it soon. Can we go back to the last topic" How to run two intance in one server?" :)

Yes, but what is your question exactly?
As I pointed out your problem seems firewall related. Running two instances means that you will also setup the firewall for both.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
steve13627
Posts: 50
Joined: 06 Dec 2016, 06:27

Re: Address already in use

Postby steve13627 » 22 Aug 2017, 02:16

Yes, It seems there is nothing to do with firewall. I can run any one of servers but two. So I suspect there is a port confliction.
steve13627
Posts: 50
Joined: 06 Dec 2016, 06:27

Re: Address already in use

Postby steve13627 » 22 Aug 2017, 03:39

Admin site, the problem has been fixed after change the http port to "8090" in file SFS2X/lib/jetty/start.d/http.ini. I can runing two instance in one server. After enable port "8090" and "9934". I also able to login the admin tool. I want to thank for your great help. :D :D

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 59 guests