PDA

View Full Version : Error: httpport option gives error



n5200
2007-02-02, 16:49
Hi everybody,

I've installed the actual SlimServer version on a Linux system.
The version string on the html administration page (near the bottom) shows: "SlimServer Version: 6.5.1 - 11206 - Linux - EN - iso-8859-1".

When I start the SlimServer without giving the --httpport option, everything is working and I can access the administration html page.

Whenever I give the --httpport option on the command line, regardless what port number I use, I always get an error message telling that the address is already in use.

I checked the debug output and it is clear why the error message is coming: the port gets opened twice.
Now I don't know why the port is opened twice. I'm a perl programmer too, but it takes me too much time to understand the initialization sequence.

Can someone help me?

Here is the debug log showing one of my tries:

2007-02-03 00:16:25.8776 SlimServer settings effective user and group if requested...
2007-02-03 00:16:25.8828 SlimServer settings init...
2007-02-03 00:16:25.9009 SlimServer strings init...
2007-02-03 00:16:26.2820 SlimServer Setup init...
2007-02-03 00:16:26.3057 SlimServer setting language...
2007-02-03 00:16:26.3060 SlimServer MySQL init...
2007-02-03 00:16:26.4400 Server /raid/data/module/SLIMSERVER/slimserver/slimserver.pl accepting http connections on port 7100
2007-02-03 00:16:27.4784 Firmware init...
2007-02-03 00:16:27.4803 SlimServer Info init...
2007-02-03 00:16:28.0637 SlimServer IR init...
2007-02-03 00:16:28.0778 SlimServer Request init...
2007-02-03 00:16:28.0859 SlimServer Buttons init...
2007-02-03 00:16:28.0912 SlimServer Graphic Fonts init...
2007-02-03 00:16:30.4354 UDP init...
2007-02-03 00:16:30.4367 Slimproto Init...
2007-02-03 00:16:30.4379 mDNS init...
2007-02-03 00:16:30.4383 Async Networking init...
2007-02-03 00:16:30.4785 Cache init...
2007-02-03 00:16:30.4817 UPnP init...
2007-02-03 00:16:30.4820 Adding handler for regular expression /(?-xism:^browseupnp\.(?:htm|xml))
2007-02-03 00:16:30.4822 Adding handler for regular expression /(?-xism:^upnpinfo\.(?:htm|xml))
2007-02-03 00:16:30.4840 SlimServer HTTP init...
2007-02-03 00:16:30.4862 Found Template::Stash::XS!
2007-02-03 00:16:30.4865 Adding handler for regular expression /(?-xism:^firmware\.(?:html|xml))
2007-02-03 00:16:30.4867 Adding handler for regular expression /(?-xism:^songinfo\.(?:htm|xml))
2007-02-03 00:16:30.4869 Adding handler for regular expression /(?-xism:^setup\.(?:htm|xml))
2007-02-03 00:16:30.4871 Adding handler for regular expression /(?-xism:^tunein\.(?:htm|xml))
2007-02-03 00:16:30.4872 Adding handler for regular expression /(?-xism:^update_firmware\.(?:htm|xml))
2007-02-03 00:16:30.4874 Adding handler for regular expression /(?-xism:^ping\.(?:htm|xml))
2007-02-03 00:16:30.4877 Adding handler for regular expression /(?-xism:^$)
2007-02-03 00:16:30.4879 Adding handler for regular expression /(?-xism:^home\.(?:htm|xml))
2007-02-03 00:16:30.4881 Adding handler for regular expression /(?-xism:^index\.(?:htm|xml))
2007-02-03 00:16:30.4883 Adding handler for regular expression /(?-xism:^squeezenetwork\.(?:htm|xml))
2007-02-03 00:16:30.4887 Adding handler for regular expression /(?-xism:^browsedb\.(?:htm|xml))
2007-02-03 00:16:30.4890 Adding handler for regular expression /(?-xism:^browseid3\.(?:htm|xml))
2007-02-03 00:16:30.4894 Adding handler for regular expression /(?-xism:^browsetree\.(?:htm|xml))
2007-02-03 00:16:30.4897 Adding handler for regular expression /favorites_list.htm
2007-02-03 00:16:30.4900 Adding handler for regular expression /(?-xism:^search\.(?:htm|xml))
2007-02-03 00:16:30.4903 Adding handler for regular expression /(?-xism:^advanced_search\.(?:htm|xml))
2007-02-03 00:16:30.4906 Adding handler for regular expression /(?-xism:^status_header\.(?:htm|xml))
2007-02-03 00:16:30.4908 Adding handler for regular expression /(?-xism:^status\.(?:htm|xml))
2007-02-03 00:16:30.4911 Adding handler for regular expression /(?-xism:^edit_playlist\.(?:htm|xml))
2007-02-03 00:16:30.4913 Adding handler for regular expression /(?-xism:^playlist\.(?:htm|xml))
2007-02-03 00:16:30.4916 Adding handler for regular expression /(?-xism:^hitlist\.(?:htm|xml))
can't setup the listening port 7100 for the HTTP server: Address already in use at /raid/data/module/SLIMSERVER/slimserver/Slim/Web/HTTP.pm line 170.
2007-02-03 00:16:30.4948 Got to the END.

kdf
2007-02-02, 18:42
Quoting n5200 <n5200.2lej9b1170460202 (AT) no-mx (DOT) forums.slimdevices.com>:

>
> Hi everybody,
>
ok, first thing (and sorry to have picked your post to finally make
this point once again) please stop using the developer forum as a
support network for slimserver usage problem. It is for helping
"developers" in creating plugins, understanding how to work with the
server codes, etc. There are several other forums to choose from, lets
please try to keep each on topic.

As for the http port error, I think it makes the problem very clear.
port 7100 is in use by something. You'll need to track down what.
Please try posting in the unix forum, as you are using linux.

for a start, try:
netstat -an |grep LISTEN|grep 7100

thanks.
kdf

n5200
2007-02-03, 03:23
Quoting n5200 <n5200.2lej9b1170460202 (AT) no-mx (DOT) forums.slimdevices.com>:

>
> Hi everybody,
>
ok, first thing (and sorry to have picked your post to finally make
this point once again) please stop using the developer forum as a
support network for slimserver usage problem. It is for helping
"developers" in creating plugins, understanding how to work with the
server codes, etc. There are several other forums to choose from, lets
please try to keep each on topic.

OK, the first thing: this was my first post here and for me it is a very unfriendly welcome procedure.

Second thing: I have clearly a problem which affects the development of this software. Where is it written that this forum is only for plugin developers? How should I know?



As for the http port error, I think it makes the problem very clear.
port 7100 is in use by something. You'll need to track down what.
Please try posting in the unix forum, as you are using linux.

for a start, try:
netstat -an |grep LISTEN|grep 7100

Thanks for the first level support help, but I'm a developer and not the end user. I clearly wrote that regardless of what port I use, that port is already busy. And I wrote that te SlimServer itself is causing this double-open of the same port.
And if you looked at my log file you would have seen the prove that the SlimServer code really opens the port specified at the command line twice.

So if this is an error in the code, then it is not not Linux related, it applies then to all operating systems.

So now, please tell me again where to post my question finally.

Not amused,

Andreas

kdf
2007-02-03, 03:31
On 3-Feb-07, at 2:23 AM, n5200 wrote:

>>
> OK, the first thing: this was my first post here and for me it is a
> very unfriendly welcome procedure.
>

as I said, not for you. addressing the flood of recent garbage.

> Second thing: I have clearly a problem which affects the development of
> this software. Where is it written that this forum is only for plugin
> developers? How should I know?
>
from the forum main page, where it describes each forum topic.

>>
>> As for the http port error, I think it makes the problem very clear.
>>
>> port 7100 is in use by something. You'll need to track down what.
>> Please try posting in the unix forum, as you are using linux.
>>
>> for a start, try:
>> netstat -an |grep LISTEN|grep 7100
>>
> Thanks for the first level support help, but I'm a developer and not
> the end user. I clearly wrote that regardless of what port I use, that
> port is already busy. And I wrote that te SlimServer itself is causing
> this double-open of the same port.
> And if you looked at my log file you would have seen the prove that the
> SlimServer code really opens the port specified at the command line
> twice.
>
> So if this is an error in the code, then it is not not Linux related,
> it applies then to all operating systems.
>
> So now, please tell me again where to post my question finally.
>
don't care.

I'm on my own time. and if you want to be an ass....I can be too :)
-kdf

n5200
2007-02-03, 03:52
At the forum main page, the description for the Developers is "A place for the SlimServer development team to meet." This is what I wanted to do.

I don't know why you are calling me an asshole and maybe this is just the language you know.

I porting the software to a Thecus N5200 device. I'm almost finished and this is the very last open item.

I've tried to ask a very specific question which is indeed an development issue as I think it is a generic bug in the source code affecting all operating systems.

Finally I hope there are other developer here addressing my issue and not treating me in this rude way.

Thanks

Andreas

kdf
2007-02-03, 03:59
On 3-Feb-07, at 2:52 AM, n5200 wrote:

>
> At the forum main page, the description for the *Developers* is "*A
> place for the SlimServer development team to meet.*" This is what I
> wanted to do.
>
no, you asked a support question. I gave you pointers, and the right
forum.

> I don't know why you are calling me an asshole and maybe this is just
> the language you know.
>

no...'hole' was nothing to do with it.

>
> Finally I hope there are other developer here addressing my issue and
> not treating me in this rude way.
>
yup me too. I'm tired of types like you. you HAVE your direction.
claiming rudeness is just lame until you have a result from said
direction.
-kdf

Grotus
2007-02-06, 10:17
This is a bug in SlimServer. This is how it happens, I can't fix it
currently as my computer at home is down and I haven't had a chance
to fix it.

The sequence of events is this:

slimserver.pl
initSettings is called
httpport is set, so Slim::Utils::Prefs::set is called
the httpport pref has an prefChange function which calls
Slim::Web::HTTP::adjustHTTPPort
adjustHTTPPort sets a timer to call
Slim::Web::HTTP::_adjustHTTPPortCallback
_adjustHTTPPortCallback checks to see if there is already an open
port, closing it if there is, then calls Slim::Web::HTTP::openport

more initialization in slimserver.pl...

Slim::Web::HTTP::init2 is called
Slim::Web::HTTP::openport is called without checking to see if the
port is already open


So, the problem is that we adjust the HTTP port, thus opening it,
before we were ready to have the port open. We need to process the
command line before the port is opened, so we can't just shuffle the
init sequence. My thinking is that we need to make sure not to open
a port from the adjustHTTPPort call if we have not gone through init2
yet.

This is my recommendation for Slim::Web::HTTP.pm

Initialize $openedport to undef rather than 0.
Add an "else ( $openedport = 0;}" to the init2 function's if statement
Add at the beginning of adjustHTTPPort:
if (!defined $openedport) {return;}

Unconnected with the bug:
Remove the ", $Bin" from the openport calls from init2 and
_adjustHTTPPortCallback, it isn't needed anymore.

Triode
2007-02-06, 13:18
Thanks - that explains it. But is it not easier to get rid of the on change
for the pref and put an explicit call into the web handler to reopen the
port.

Seems to me that the pref onchange code is there to catch people out (me
included) and I'm not really sure what it is adding in this case?


----- Original Message -----
From: "Moser, Robert L. II" <rlmoser (AT) comcast (DOT) net>
To: "Slim Devices Developers" <developers (AT) lists (DOT) slimdevices.com>
Sent: Tuesday, February 06, 2007 5:17 PM
Subject: Re: [Developers] Error: httpport option gives error


> This is a bug in SlimServer. This is how it happens, I can't fix it
> currently as my computer at home is down and I haven't had a chance
> to fix it.
>
> The sequence of events is this:
>
> slimserver.pl
> initSettings is called
> httpport is set, so Slim::Utils::Prefs::set is called
> the httpport pref has an prefChange function which calls
> Slim::Web::HTTP::adjustHTTPPort
> adjustHTTPPort sets a timer to call
> Slim::Web::HTTP::_adjustHTTPPortCallback
> _adjustHTTPPortCallback checks to see if there is already an open
> port, closing it if there is, then calls Slim::Web::HTTP::openport
>
> more initialization in slimserver.pl...
>
> Slim::Web::HTTP::init2 is called
> Slim::Web::HTTP::openport is called without checking to see if the
> port is already open
>
>
> So, the problem is that we adjust the HTTP port, thus opening it,
> before we were ready to have the port open. We need to process the
> command line before the port is opened, so we can't just shuffle the
> init sequence. My thinking is that we need to make sure not to open
> a port from the adjustHTTPPort call if we have not gone through init2
> yet.
>
> This is my recommendation for Slim::Web::HTTP.pm
>
> Initialize $openedport to undef rather than 0.
> Add an "else ( $openedport = 0;}" to the init2 function's if statement
> Add at the beginning of adjustHTTPPort:
> if (!defined $openedport) {return;}
>
> Unconnected with the bug:
> Remove the ", $Bin" from the openport calls from init2 and
> _adjustHTTPPortCallback, it isn't needed anymore.
>

Grotus
2007-02-08, 09:52
You can also change the httpport pref via the CLI. If the code to
trigger a port change is only in the web handler, then that case will
be missed.

On Feb 6, 2007, at 12:18 PM, Triode wrote:

> Thanks - that explains it. But is it not easier to get rid of the
> on change
> for the pref and put an explicit call into the web handler to
> reopen the
> port.
>
> Seems to me that the pref onchange code is there to catch people
> out (me
> included) and I'm not really sure what it is adding in this case?
>
>
> ----- Original Message -----
> From: "Moser, Robert L. II" <rlmoser (AT) comcast (DOT) net>
> To: "Slim Devices Developers" <developers (AT) lists (DOT) slimdevices.com>
> Sent: Tuesday, February 06, 2007 5:17 PM
> Subject: Re: [Developers] Error: httpport option gives error
>
>
>> This is a bug in SlimServer. This is how it happens, I can't fix it
>> currently as my computer at home is down and I haven't had a chance
>> to fix it.
>>
>> The sequence of events is this:
>>
>> slimserver.pl
>> initSettings is called
>> httpport is set, so Slim::Utils::Prefs::set is called
>> the httpport pref has an prefChange function which calls
>> Slim::Web::HTTP::adjustHTTPPort
>> adjustHTTPPort sets a timer to call
>> Slim::Web::HTTP::_adjustHTTPPortCallback
>> _adjustHTTPPortCallback checks to see if there is already an open
>> port, closing it if there is, then calls Slim::Web::HTTP::openport
>>
>> more initialization in slimserver.pl...
>>
>> Slim::Web::HTTP::init2 is called
>> Slim::Web::HTTP::openport is called without checking to see if the
>> port is already open
>>
>>
>> So, the problem is that we adjust the HTTP port, thus opening it,
>> before we were ready to have the port open. We need to process the
>> command line before the port is opened, so we can't just shuffle the
>> init sequence. My thinking is that we need to make sure not to open
>> a port from the adjustHTTPPort call if we have not gone through init2
>> yet.
>>
>> This is my recommendation for Slim::Web::HTTP.pm
>>
>> Initialize $openedport to undef rather than 0.
>> Add an "else ( $openedport = 0;}" to the init2 function's if
>> statement
>> Add at the beginning of adjustHTTPPort:
>> if (!defined $openedport) {return;}
>>
>> Unconnected with the bug:
>> Remove the ", $Bin" from the openport calls from init2 and
>> _adjustHTTPPortCallback, it isn't needed anymore.
>>

Pellicle
2007-02-10, 08:27
N5200 - Apologies given to your reception in these forums. It is clear you are trying to expand the application of slimserver to a new device and this is a service to the SS commuinity at large.

Thanks fory your contribution to the Thecus owners looking for this capability and to opening another option up to SD customers in general.

Triode
2007-02-15, 12:03
> This is my recommendation for Slim::Web::HTTP.pm
>
> Initialize $openedport to undef rather than 0.
> Add an "else ( $openedport = 0;}" to the init2 function's if statement
> Add at the beginning of adjustHTTPPort:
> if (!defined $openedport) {return;}
>
> Unconnected with the bug:
> Remove the ", $Bin" from the openport calls from init2 and
> _adjustHTTPPortCallback, it isn't needed anymore.

Thanks Robert - commited to trunk and 6.5. I note that 6.5 crashed
when --httpport was used, whereas trunk worked but with errors. Both seem
OK to me now.