Re: [g...@wooledge.org: Re: Fw: locating blocked port]

2023-02-10 Thread Curt
On 2023-02-04, Haines Brown  wrote:
> - Forwarded message from Greg Wooledge  -
>
> Date: Thu, 2 Feb 2023 08:57:30 -0500
> From: Greg Wooledge 
> To: debian-user@lists.debian.org
> Subject: Re: Fw: locating blocked port
>
> I finally managed to get jabref to run. 
>

Your first post's terminal ouput:

 Arguments passed on to running JabRef instance. Shutting down.
***

So as some poor soul who was ignored already pointed out, I'm afraid the
problem as well as its solution was manifest from the very beginning.



[g...@wooledge.org: Re: Fw: locating blocked port]

2023-02-04 Thread Haines Brown
- Forwarded message from Greg Wooledge  -

Date: Thu, 2 Feb 2023 08:57:30 -0500
From: Greg Wooledge 
To: debian-user@lists.debian.org
Subject: Re: Fw: locating blocked port

I finally managed to get jabref to run. 

I looked at waht aprocess was using the PIS as you suggest.

  $ ps -fp 1675
  UIDPID  PPID  C STIME TTY  TIME CMD
  haines1675  1559  0 Feb01 tty1 00:04:36 java -jar 
/usr/local/share/JabRef/JabRef-3.2.jar

I thn kill the process and verify that port 6050 is not being used. 

I then try to start by old version (3.2) of jabref:

  $ java -jar /usr/local/share/JabRef/JabRef-3.2.jar &
  [1] 1867
  haines@lenin:~$ Feb 04, 2023 6:58:02 AM net.sf.jabref.JabRef 
  openBibFile
  INFO: Opening: /home/haines/bibtex/historiography.bib
  Feb 04, 2023 6:58:02 AM net.sf.jabref.importer.OpenDatabaseAction 
loadDatabase
  INFO: Synchronized special fields based on keywords
  Feb 04, 2023 6:58:02 AM net.sf.jabref.JabRef openBibFile
  INFO: Opening: /home/haines/bibtex/history.bib
  Feb 04, 2023 6:58:02 AM net.sf.jabref.importer.OpenDatabaseAction 
loadDatabase
  INFO: Synchronized special fields based on keywords
  Exception in thread "AWT-EventQueue-0" java.lang.Error: Unable to 
  make void java.awt.EventDispatchThread.pumpEvents(>
at 
spin.off.AWTReflectDispatcherFactory.(AWTReflectDispatcherFactory.java:139)
at spin.off.SpinOffEvaluator.(SpinOffEvaluator.java:38)
at spin.Spin.(Spin.java:67)
  ...
 
It seems javref is trying to load two databases but it but it does 
not display. I suspect that is because my jabef is too old.
Neverthesless java owns port 6050 and so I kill the process. I next
load the up to date version of jabref

  $ jabref
  07:06:01.125 [AWT-EventQueue-0] WARN  net.sf.jabref.JabRefGUI - 
There seem to be problems
with OpenJDK and the default GTK Look Using Metal L 
instead. Change to another
L with caution.
  07:06:44.206 [AWT-EventQueue-0] INFO  
net.sf.jabref.logic.importer.OpenDatabase - Opening:
/home/haines/bibtex/historiography.bib
  07:06:47.708 [AWT-EventQueue-0] INFO  
net.sf.jabref.logic.importer.OpenDatabase - Opening:
  /home/haines/bibtex/history.bib

This this time jabref started. I opened three databaes it didn't open 
automatically. Another database it did see. I pyt thst issue aside.

While writing this message jabref crashed and no longer claims 
port 6060. I restarted it and so far it has no crashed. 



On Thu, Feb 02, 2023 at 08:48:43AM -0500, Haines Brown wrote:
> > Now the quetion is, what process is using that port?
> > 
> >$ sudo ss -pt state listening 'sport = :6050'
> >Recv-Q  Send-Q  Local Address:Port   Peer Address:Port  
> >Process
> >0   1   [:::127.0.0.1]:6050  *:*
> >users:(("java",pid=1675,fd=14))
> > 
> > Is java holding that port? Is jabref then trying to use the port 
> > for itself? If so, is this a bug? (I run testing)

> You've got a PID, so the next thing *I* would do is ps -fp 1675



-- 

 Haines Brown 
 /"\
 \ /  ASCII Ribbon Campaign
  Xagainst HTML e-mail 
 / \



Re: Fw: locating blocked port

2023-02-02 Thread Greg Wooledge
On Thu, Feb 02, 2023 at 08:48:43AM -0500, Haines Brown wrote:
> Now the quetion is, what process is using that port?
> 
>$ sudo ss -pt state listening 'sport = :6050'
>Recv-Q  Send-Q  Local Address:Port   Peer Address:Port  Process
>0   1   [:::127.0.0.1]:6050  *:*
> users:(("java",pid=1675,fd=14))
> 
> Is java holding that port? Is jabref then trying to use the port for 
> itself? If so, is this a bug? (I run testing)

You've got a PID, so the next thing *I* would do is ps -fp 1675

> Is there any way I can tell java or jabref to use next available 
> free port?

You'd have to edit the jabref source code, and rebuild it.  And if you're
going to do that, you might as well grab the upstream version instead of
using the Debian version.  Who knows -- the newer upstream versions
might have already done something about this.



Re: Fw: locating blocked port

2023-02-02 Thread Haines Brown
After stumblin about and wasting people's time. I may have made some 
progress.

First was the kind help that the jabref port can be found by searching 
on line for "net.sf.jabref.logic.remote.server" Remote port number". 
Doing so revealed that jabref's default port is probably 6050. I 
wouild never have thought to search for that on line.

Now the quetion is, what process is using that port?

   $ sudo ss -pt state listening 'sport = :6050'
   Recv-Q  Send-Q  Local Address:Port   Peer Address:Port  Process
   0   1   [:::127.0.0.1]:6050  *:*
users:(("java",pid=1675,fd=14))

Is java holding that port? Is jabref then trying to use the port for 
itself? If so, is this a bug? (I run testing)

Is there any way I can tell java or jabref to use next available 
free port?

-- 

 Haines Brown 
 /"\
 \ /  ASCII Ribbon Campaign
  Xagainst HTML e-mail 
 / \



Re: Fw: locating blocked port

2023-02-01 Thread Jeffrey Walton
On Wed, Feb 1, 2023 at 5:24 PM  wrote:
>
> [...]
> Begin forwarded message:
>
> Date: Wed, 1 Feb 2023 06:09:32 -0500
> From: Haines Brown 
> To: debian-u...@howorth.org.uk
> Subject: Re: locating blocked port
>
> On Tue, Jan 31, 2023 at 10:09:28PM +, debian-u...@howorth.org.uk
> wrote:
> > Haines Brown wrote:
> > >   $ jabref
> ...
> > > 15:43:56.628 [AWT-EventQueue-0] INFO  net.sf.jabref.JabRefMain -
> > > Arguments passed on to running JabRef instance. Shutting down.
> >
> > The last line there seems to imply there is already another instance
> > of jabref running. Is that the case? What does
> >
> > $ ps -fe | grep jabref
> >
> > show, for example?
>
> Yes indeed. It showed two instances of jabref. I killed the processes
> and now
>
>   $ ps -fe | grep jabref
>   haines3597  3160  0 06:02 pts/100:00:00 grep jabref
>
> So I should be able to start jabref:
>
>   $ jabref
>   06:04:08.576 [AWT-EventQueue-0] WARN
> net.sf.jabref.logic.remote.server.RemoteListenerServerLifecycle -
>   Port is blocked
>   java.net.BindException: Address already in use
>   ...
>   06:04:08.591 [AWT-EventQueue-0] INFO  net.sf.jabref.JabRefMain -
> Arguments passed on to running JabRef instance. Shutting down.
>
> It seems that the jabref command i starts jabref twice. Hoewver the
> $ ps -fe command does not show them

After you kill an instance of jabref, the socket may be in a linger
state. I.e., SO_LINGER socket option in C.
https://duckduckgo.com/?q=so_linger+socket+option .

You should be able to check the source code to see if jabref is using
the option. 
https://docs.oracle.com/javase/7/docs/api/java/net/StandardSocketOptions.html#SO_LINGER
.

The short of it is, if the option is being used, then you should wait
about 2 minutes before you try to start the program again.

Jeff



Fw: locating blocked port

2023-02-01 Thread debian-user


Haines Brown sent a reply directly to me instead of the list in
response to the post I made. I advised him to send his reply to the
list instead. He didn't, he just forwarded me another copy of his
reply. So here's his reply so anybody that's interested can read it. I
expect Haines may end up in my bitbucket soon.

Begin forwarded message:

Date: Wed, 1 Feb 2023 06:09:32 -0500
From: Haines Brown 
To: debian-u...@howorth.org.uk
Subject: Re: locating blocked port


On Tue, Jan 31, 2023 at 10:09:28PM +, debian-u...@howorth.org.uk
wrote:
> Haines Brown wrote:  
> >   $ jabref  
...
> > 15:43:56.628 [AWT-EventQueue-0] INFO  net.sf.jabref.JabRefMain -
> > Arguments passed on to running JabRef instance. Shutting down.  
> 
> The last line there seems to imply there is already another instance
> of jabref running. Is that the case? What does
> 
> $ ps -fe | grep jabref
> 
> show, for example?  

Yes indeed. It showed two instances of jabref. I killed the processes
and now

  $ ps -fe | grep jabref
  haines3597  3160  0 06:02 pts/100:00:00 grep jabref

So I should be able to start jabref:

  $ jabref
  06:04:08.576 [AWT-EventQueue-0] WARN  
net.sf.jabref.logic.remote.server.RemoteListenerServerLifecycle - 
  Port is blocked
  java.net.BindException: Address already in use
  ...
  06:04:08.591 [AWT-EventQueue-0] INFO  net.sf.jabref.JabRefMain - 
Arguments passed on to running JabRef instance. Shutting down.

It seems that the jabref command i starts jabref twice. Hoewver the 
$ ps -fe command does not show them

-- 

 Haines Brown 
 /"\
 \ /  ASCII Ribbon Campaign
  Xagainst HTML e-mail 
 / \



Re: locating blocked port

2023-02-01 Thread Greg Wooledge
This ENTIRE THREAD is a gigantic cautionary tale for developers.  This is
why trying to minimize the amount of information present in your error
messages is NOT helpful.

The Microsoft paradigm of "don't show technical details in error messages
because it will scare the users" is bullshit.  But to be fair, at least
most Windows applications with useless error messages have a button that
you can click to get more details.

Of course, that can't happen when you're writing error text to stderr and
aborting.  In those cases, whatever you write, that's it.  That's all the
user gets.

A stack trace showing WHERE an error occurs is only useful for you, the
developer.  It's not useful for the end user.  The end user needs to
know WHAT went wrong, and to the extent possible, WHY it went wrong.

If you can't open a file, don't just say "can't open file".  Give the NAME
of the file, and the operating system's reason why the file couldn't be
opened.

If you can['t listen on a port, don't just say "can't listen on my port".
Ssy WHAT PORT you're trying to listen on.

...

Now, let's try to accomplish something.

I did a Google search for "jabref documentation", but that was a
non-starter.  The documentation is written for end users who are not
experiencing trouble just *running* the thing.  It's full of pretty
pictures that I'm sure are helpful for someone else.

Next, I did a Google search for "net.sf.jabref.logic.remote.server.Remote
port number".  This led me to
 which discusses this
issue, or at least a very similar issue.

One of the comments on that page says:

  Quick fix would be not to define 6050 as hard coded port as default but
  using defaults.put(REMOTE_SERVER_PORT, 6000+((int) Math.random()*1000);
  for a range between port 6000 and 6999

So maybe it's trying to use port 6050.

I'd advise the OP to read that page, or at least skim it.  The issue that
the bug reporter was experiencing was caused by attempts to run multiple
instances of jabref on the same computer (by multiple users).  This raises
the possibility that the OP is also trying to run multiple simultaneous
instances of jabref, possibly without knowing it.

Of course it's also possible that something else, totally unrelated to
jabref, is using the port in question.

 tells us that thie port is
also (possibly) used by "ARCserve agent", "Brightstor Arcserve Backup"
and "Nortel Software" in addition to a possible use by X11, if for some
reason you've got over 50 displays opened.



Re: locating blocked port

2023-02-01 Thread davenull

Hello

On 2023-01-31 16:05, Haines Brown wrote:

I have an  application that refuses to start because  its port is
blocked. But I have difficulty knowing what port it is

   $ java -jar /usr/local/share/JabRef/JabRef-3.2.jar &
  [1] 4831
  haines@lenin:~$ Jan 31, 2023 8:36:39 AM
net.sf.jabref.logic.remote.server.Remote
  ListenerServerLifecycle open
  WARNING: Port is blocked
  java.net.BindException: Address already in use
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Net.java:555)
at java.base/sun.nio.ch.Net.bind(Net.java:544)
at 
java.base/sun.nio.ch.NioSocketImpl.bind(NioSocketImpl.java:643)

at java.base/java.net.ServerSocket.bind(ServerSocket.java:388)
at 
java.base/java.net.ServerSocket.(ServerSocket.java:274)

at
net.sf.jabref.logic.remote.server.RemoteListenerServer.(RemoteListenerServer.java:40)
at
net.sf.jabref.logic.remote.server.RemoteListenerServerThread.(RemoteListenerServerThread.java:33)
at
net.sf.jabref.logic.remote.server.RemoteListenerServerLifecycle.open(RemoteListenerServerLifecycle.java:41)
at net.sf.jabref.JabRef.start(JabRef.java:137)
at net.sf.jabref.JabRefMain.main(JabRefMain.java:8)

  Arguments passed on to running JabRef instance. Shutting down.

How do I know from this what port the java application tried to use?

I try:

  $ strings $(which jabref) | wc -l
56

  So I try:

$ sudo ss -pt state listening 'sport = :56'
Recv-Q   Send-QLocal Address:Port   Peer Address:Port Process

  This seems a null return. Dores this mean jabref is not using port
  56?



If ss, or lsof, or any other tool that shows used ports doesn't show 
port 56 being used. Then it's not being used. Or in your case, since 
you're filtering ss output to only listening TCP ports, IF it being 
used, it might be on a different state that "listening".
Or it could be UDP, but I'm assuming you except jabref to use a TCP 
port, thus the use of '-t' option (Disclaimer, I don't what protocols 
jabref uses)


However I'm not sure what makes you think jabref is trying to use 
(either TCP or UDP) port 56. It your example you didn't show or tell 
what to tried to determine it's supposed to use that specific port. wc 
-l counts lines and have nothing to do with port numbers. So


$ command | wc -l

Returns the number of lines outputted by "command" (whatever before 
pipe). In your case, "strings $(which jabref)" outputs 56 lines.


"sudo lsof -i" as a sudoer user, or "lsof -i" as root (elevated 
privileges required to trace used ports) should list processes/commands 
using ports, for both listening and established.
OR just "sudo ss -pt state listening" without specifying a source port 
to see all the listening port to use used ports, then compare it to 
'whatever port number' jabref's documentations says the software uses.


Also, starting jabref with strace, using the network filter, something 
like "sudo strace -f -e trace=network 
$InsertHereWhateverCommandYouUseToStartJabref", should help you to see 
what port it's trying to use.




Re: locating blocked port

2023-02-01 Thread Henning Follmann
On Tue, Jan 31, 2023 at 03:51:20PM -0500, Haines Brown wrote:
> On Tue, Jan 31, 2023 at 12:13:03PM -0500, Henning Follmann wrote:
>  
> > I think this is just futile. Why would you do all this painful stuff,
> > which might not get you close to what you really want - running that app.
> 
> Are you implying the problem should not occur?

No, apparently the problem occurs. However (and this might sound harsh)
someone who seems to just run a command she/he found somewhere (on the
internet?). You clearly did not understand what that command was doing,
because I do not believe you think the number of text strings in a program
in any way relates to an port that program listens to.
So I am saying base on that I made the judgement that you will not get
anywhere by running strace, and the advise given to you was not a good one.
Also I do not understand why you are so focused on finding that port.
I would go to the documentation of this Project and start looking at that.
https://docs.jabref.org/

And it even has a faq section for linux.
That might be a good start.
 

>  
> > For now I just assume you installed jabref via the debian packaging system?
> > Please just try to start jabref through the system menu.
> 
> Yes, I did a normal # aptitude install of jabref. I don't have a 
> desktop manager but my window manager has an applications menu. I've 
> never used it but I look for jabref and its not in the mentu. The 
> jabref command is in my path and so I simply do:

well, what you say you did differs from the original post. There you called
java with a path to the jar.
You will find also in the faq section an answer why that might be a bad
idea.

BTW. The offical debian package of this application is quite old (I think
it is 3.8). You might download the newest version from that project site.
That versin comes with a embedded jre. Maybe try that.


-- 
Henning Follmann   | hfollm...@itcfollmann.com



Re: locating blocked port

2023-01-31 Thread tv.debian

Le 31/01/2023 à 16:31, Casey Deccio a écrit :




On Jan 31, 2023, at 8:05 AM, Haines Brown  wrote:

I have an  application that refuses to start because  its port is
blocked. But I have difficulty knowing what port it is


I would try strace, which shows you all system calls being made.  In this case, 
it is probably bind() that is returning an error.

strace -e trace=%net java -jar /usr/local/share/JabRef/JabRef-3.2.jar

Or

strace -e trace=%net java -jar /usr/local/share/JabRef/JabRef-3.2.jar 2>&1 | 
grep bind

For example:

$ cat test.py
#!/usr/bin/env python3

import socket
s = socket.socket()
try:
 s.bind(('0.0.0.0', 56))
except:
 pass
$ python3 test.py # doesn't print any output
$ strace -e trace=%net python3 test.py 2>&1 | grep bind
bind(3, {sa_family=AF_INET, sin_port=htons(56), sin_addr=inet_addr("0.0.0.0")}, 
16) = -1 EACCES (Permission denied)

The value of sin_port is what you are looking for.


How do I know from this what port the java application tried to use?

I try:

  $ strings $(which jabref) | wc -l
56



strings might be helpful (maybe?), but in this case, you are piping it to wc 
-l, which is simply counting the number of printable character sequences that 
were found in jabref.  If that also happens to be the port number, then it is 
coincidental.


  So I try:

$ sudo ss -pt state listening 'sport = :56'
Recv-Q   Send-QLocal Address:Port   Peer Address:Port Process

  This seems a null return. Dores this mean jabref is not using port
  56?


Well, it tells you that nothing (including jabref) is listening on TCP port 56, 
but it won't tell you about why something *failed* to listen.  See strace above.

Casey


If you want an easy way to tell what program is trying to send data 
through which port(s), aside from all the command line utilities linux 
is known for you can use "opensnitch" which comes with a nice UI. It is 
in Debian but in Unstable [1] only for now, however the upstream website 
[2] provides .deb packages [3] and instructions. "Wireshark" or 
"iptraf-ng" also offer UI but are less intuitive to use, and 
"opensnitch" allows you to create rules from the UI to allow/block traffic.


[1] 
https://packages.debian.org/search?keywords=opensnitch=names=unstable=all


[2] https://github.com/evilsocket/opensnitch

[3] https://github.com/evilsocket/opensnitch/releases



Re: locating blocked port

2023-01-31 Thread debian-user
Haines Brown wrote:
>   $ jabref
>   15:43:56.614 [AWT-EventQueue-0] WARN  
> net.sf.jabref.logic.remote.server.RemoteListenerServerLifecycle - 
> Port is blocked
>   java.net.BindException: Address already in use
> at sun.nio.ch.Net.bind0(Native Method) ~[?:?]
> at sun.nio.ch.Net.bind(Net.java:555) ~[?:?]
> at sun.nio.ch.Net.bind(Net.java:544) ~[?:?]
> at sun.nio.ch.NioSocketImpl.bind(NioSocketImpl.java:643)
> ~[?:?] at java.net.ServerSocket.bind(ServerSocket.java:388) ~[?:?]
> at java.net.ServerSocket.(ServerSocket.java:274) ~[?:?]
> at
> net.sf.jabref.logic.remote.server.RemoteListenerServer.
> (RemoteListenerServer.java:26) ~[JabRef-3.8.2.jar:?] ...
> 
>[Many more lines for jav.awt]
> 
>  at
> java.awt.EventDispatchThread.run(EventDispatchThread.java:90) ~[?:?]
> 15:43:56.628 [AWT-EventQueue-0] INFO  net.sf.jabref.JabRefMain -
> Arguments passed on to running JabRef instance. Shutting down.

The last line there seems to imply there is already another instance of
jabref running. Is that the case? What does

$ ps -fe | grep jabref

show, for example?



Re: locating blocked port

2023-01-31 Thread Haines Brown
On Tue, Jan 31, 2023 at 12:13:03PM -0500, Henning Follmann wrote:
 
> I think this is just futile. Why would you do all this painful stuff,
> which might not get you close to what you really want - running that app.

Are you implying the problem should not occur?
 
> For now I just assume you installed jabref via the debian packaging system?
> Please just try to start jabref through the system menu.

Yes, I did a normal # aptitude install of jabref. I don't have a 
desktop manager but my window manager has an applications menu. I've 
never used it but I look for jabref and its not in the mentu. The 
jabref command is in my path and so I simply do:

  $ jabref
  15:43:56.614 [AWT-EventQueue-0] WARN  
net.sf.jabref.logic.remote.server.RemoteListenerServerLifecycle - 
Port is blocked
  java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method) ~[?:?]
at sun.nio.ch.Net.bind(Net.java:555) ~[?:?]
at sun.nio.ch.Net.bind(Net.java:544) ~[?:?]
at sun.nio.ch.NioSocketImpl.bind(NioSocketImpl.java:643) ~[?:?]
at java.net.ServerSocket.bind(ServerSocket.java:388) ~[?:?]
at java.net.ServerSocket.(ServerSocket.java:274) ~[?:?]
at net.sf.jabref.logic.remote.server.RemoteListenerServer.
(RemoteListenerServer.java:26) ~[JabRef-3.8.2.jar:?]
...

   [Many more lines for jav.awt]

   at java.awt.EventDispatchThread.run(EventDispatchThread.java:90) 
~[?:?]
   15:43:56.628 [AWT-EventQueue-0] INFO  net.sf.jabref.JabRefMain - 
 Arguments passed on to running JabRef instance. Shutting down.
-- 

 Haines Brown 
 /"\
 \ /  ASCII Ribbon Campaign
  Xagainst HTML e-mail 
 / \



Re: locating blocked port

2023-01-31 Thread Henning Follmann
On Tue, Jan 31, 2023 at 11:30:02AM -0500, Haines Brown wrote:
> On Tue, Jan 31, 2023 at 08:31:38AM -0700, Casey Deccio wrote:
> > 
> > 
> > > On Jan 31, 2023, at 8:05 AM, Haines Brown  wrote:
> > > 
> > > I have an  application that refuses to start because  its port is 
> > > blocked. But I have difficulty knowing what port it is
> 
> > I would try strace, which shows you all system calls being made.  In 
> > this case, it is probably bind() that is returning an error.
> 
> I do   
> 
>   $ strace -e trace=%net java -jar /usr/local/share/JabRef/JabRef-3.2.jar 
> 2>&1 | grep bind
> at java.base/sun.nio.ch.Net.bind0(Native Method)
> at java.base/sun.nio.ch.Net.bind(Net.java:555)
> at java.base/sun.nio.ch.Net.bind(Net.java:544)
> at java.base/sun.nio.ch.NioSocketImpl.bind(NioSocketImpl.java:643)
> at java.base/java.net.ServerSocket.bind(ServerSocket.java:388)
> 
> But this does not tell me what is bound to what port. 
> 
> > For example:
> > 
> > $ cat test.py 
> > #!/usr/bin/env python3
> 
> In /usr/bin there is a jabref file, but it does not specify what port 
> it uses.
> 
> > import socket
> > s = socket.socket()
> > try:
> > s.bind(('0.0.0.0', 56))
> > except:
> > pass
> > $ python3 test.py # doesn't print any output
> 
> > $ strace -e trace=%net python3 test.py 2>&1 | grep bind
> > bind(3, {sa_family=AF_INET, sin_port=htons(56), 
> > sin_addr=inet_addr("0.0.0.0")}, 16) = -1 EACCES (Permission denied)
> > 
> > The value of sin_port is what you are looking for.
> 
> My run of the strace command as above does not return the string 
> sin_port.,
> > 
> > > How do I know from this what port the java application tried to use?
> 
> > >  So I try:
> > > 
> > >$ sudo ss -pt state listening 'sport = :56'
> > >Recv-Q   Send-QLocal Address:Port   Peer Address:Port Process
> > > 
> > >  This seems a null return. Dores this mean jabref is not using port 
> > >  56?
> > 
> > Well, it tells you that nothing (including jabref) is listening on 
> > TCP port 56, but it won't tell you about why something *failed* to listen.  
> > See strace above. 
> 
> I don't see in refurn for strace that anyhing is not listening to 
> port 56.
> 
>  Casey, thanks for your effort to help, but I'm too ill infomred to 
> benefit from your advice.
> 

I think this is just futile. Why would you do all this painful stuff,
which might not get you close to what you really want - running that app.

For now I just assume you installed jabref via the debian packaging system?
Please just try to start jabref through the system menu.


-H

-- 
Henning Follmann   | hfollm...@itcfollmann.com



Re: locating blocked port

2023-01-31 Thread Henning Follmann
On Tue, Jan 31, 2023 at 10:05:12AM -0500, Haines Brown wrote:
> I have an  application that refuses to start because  its port is 
> blocked. But I have difficulty knowing what port it is
> 
>$ java -jar /usr/local/share/JabRef/JabRef-3.2.jar &
>   [1] 4831
>   haines@lenin:~$ Jan 31, 2023 8:36:39 AM  
> net.sf.jabref.logic.remote.server.Remote
>   ListenerServerLifecycle open
>   WARNING: Port is blocked
>   java.net.BindException: Address already in use
> at java.base/sun.nio.ch.Net.bind0(Native Method)
> at java.base/sun.nio.ch.Net.bind(Net.java:555)
> at java.base/sun.nio.ch.Net.bind(Net.java:544)
> at java.base/sun.nio.ch.NioSocketImpl.bind(NioSocketImpl.java:643)
> at java.base/java.net.ServerSocket.bind(ServerSocket.java:388)
> at java.base/java.net.ServerSocket.(ServerSocket.java:274)
> at 
> net.sf.jabref.logic.remote.server.RemoteListenerServer.(RemoteListenerServer.java:40)
> at 
> net.sf.jabref.logic.remote.server.RemoteListenerServerThread.(RemoteListenerServerThread.java:33)
> at 
> net.sf.jabref.logic.remote.server.RemoteListenerServerLifecycle.open(RemoteListenerServerLifecycle.java:41)
> at net.sf.jabref.JabRef.start(JabRef.java:137)
> at net.sf.jabref.JabRefMain.main(JabRefMain.java:8)
> 
>   Arguments passed on to running JabRef instance. Shutting down.
> 
> How do I know from this what port the java application tried to use?
> 
> I try:
> 
>   $ strings $(which jabref) | wc -l
> 56

Oh boy,
why would the number of strings in that binary ever relate to the port
being used?

How about looking at the documentation instead?
https://docs.jabref.org



> 
>   So I try:
> 
> $ sudo ss -pt state listening 'sport = :56'
> Recv-Q   Send-QLocal Address:Port   Peer Address:Port Process
> 
>   This seems a null return. Dores this mean jabref is not using port 
>   56?
> 
>

NC 


-H


-- 
Henning Follmann   | hfollm...@itcfollmann.com



Re: locating blocked port

2023-01-31 Thread Haines Brown
On Tue, Jan 31, 2023 at 08:31:38AM -0700, Casey Deccio wrote:
> 
> 
> > On Jan 31, 2023, at 8:05 AM, Haines Brown  wrote:
> > 
> > I have an  application that refuses to start because  its port is 
> > blocked. But I have difficulty knowing what port it is

> I would try strace, which shows you all system calls being made.  In 
> this case, it is probably bind() that is returning an error.

I do 

  $ strace -e trace=%net java -jar /usr/local/share/JabRef/JabRef-3.2.jar 2>&1 
| grep bind
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Net.java:555)
at java.base/sun.nio.ch.Net.bind(Net.java:544)
at java.base/sun.nio.ch.NioSocketImpl.bind(NioSocketImpl.java:643)
at java.base/java.net.ServerSocket.bind(ServerSocket.java:388)

But this does not tell me what is bound to what port. 

> For example:
> 
> $ cat test.py 
> #!/usr/bin/env python3

In /usr/bin there is a jabref file, but it does not specify what port 
it uses.

> import socket
> s = socket.socket()
> try:
> s.bind(('0.0.0.0', 56))
> except:
> pass
> $ python3 test.py # doesn't print any output

> $ strace -e trace=%net python3 test.py 2>&1 | grep bind
> bind(3, {sa_family=AF_INET, sin_port=htons(56), 
> sin_addr=inet_addr("0.0.0.0")}, 16) = -1 EACCES (Permission denied)
> 
> The value of sin_port is what you are looking for.

My run of the strace command as above does not return the string 
sin_port.,
> 
> > How do I know from this what port the java application tried to use?

> >  So I try:
> > 
> >$ sudo ss -pt state listening 'sport = :56'
> >Recv-Q   Send-QLocal Address:Port   Peer Address:Port Process
> > 
> >  This seems a null return. Dores this mean jabref is not using port 
> >  56?
> 
> Well, it tells you that nothing (including jabref) is listening on 
> TCP port 56, but it won't tell you about why something *failed* to listen.  
> See strace above. 

I don't see in refurn for strace that anyhing is not listening to 
port 56.

 Casey, thanks for your effort to help, but I'm too ill infomred to 
benefit from your advice.

-- 

 Haines Brown 
 /"\
 \ /  ASCII Ribbon Campaign
  Xagainst HTML e-mail 
 / \



Re: locating blocked port

2023-01-31 Thread Casey Deccio



> On Jan 31, 2023, at 8:05 AM, Haines Brown  wrote:
> 
> I have an  application that refuses to start because  its port is 
> blocked. But I have difficulty knowing what port it is

I would try strace, which shows you all system calls being made.  In this case, 
it is probably bind() that is returning an error.

strace -e trace=%net java -jar /usr/local/share/JabRef/JabRef-3.2.jar

Or

strace -e trace=%net java -jar /usr/local/share/JabRef/JabRef-3.2.jar 2>&1 | 
grep bind

For example:

$ cat test.py 
#!/usr/bin/env python3

import socket
s = socket.socket()
try:
   s.bind(('0.0.0.0', 56))
except:
   pass
$ python3 test.py # doesn't print any output
$ strace -e trace=%net python3 test.py 2>&1 | grep bind
bind(3, {sa_family=AF_INET, sin_port=htons(56), sin_addr=inet_addr("0.0.0.0")}, 
16) = -1 EACCES (Permission denied)

The value of sin_port is what you are looking for.

> How do I know from this what port the java application tried to use?
> 
> I try:
> 
> $ strings $(which jabref) | wc -l
>   56
> 

strings might be helpful (maybe?), but in this case, you are piping it to wc 
-l, which is simply counting the number of printable character sequences that 
were found in jabref.  If that also happens to be the port number, then it is 
coincidental.

> So I try:
> 
>   $ sudo ss -pt state listening 'sport = :56'
>   Recv-Q   Send-QLocal Address:Port   Peer Address:Port Process
> 
> This seems a null return. Dores this mean jabref is not using port 
> 56?

Well, it tells you that nothing (including jabref) is listening on TCP port 56, 
but it won't tell you about why something *failed* to listen.  See strace above.

Casey


Re: locating blocked port

2023-01-31 Thread Klaus Singvogel


Hi,

Haines Brown wrote:
> I have an  application that refuses to start because  its port is 
> blocked. But I have difficulty knowing what port it is
> 
[...]
> 
>   $ strings $(which jabref) | wc -l
> 56

This "56" does NOT mean, jabref is listening on Port 56.
It only means, that the jabref command contains 56 lines of human readable 
characters.

You might want to look out for a config file for jabref to get the port number, 
or read the source code, especially for lines like: listen() or bind().

Sorry, but your way wasn't that helpful to get some clues about the required 
port.

Btw. ports below 1024 are only allowed for system services. Which means they 
require adminstration rights (= you must be root), to get such a port.
I doubt that this is the case here.

Best regards,
Klaus.
-- 
Klaus Singvogel
GnuPG-Key-ID: 1024R/5068792D  1994-06-27



Re: locating blocked port

2023-01-31 Thread Celejar
On Tue, 31 Jan 2023 10:05:12 -0500
Haines Brown  wrote:

> I have an  application that refuses to start because  its port is 
> blocked. But I have difficulty knowing what port it is
> 
>$ java -jar /usr/local/share/JabRef/JabRef-3.2.jar &
>   [1] 4831
>   haines@lenin:~$ Jan 31, 2023 8:36:39 AM  
> net.sf.jabref.logic.remote.server.Remote
>   ListenerServerLifecycle open
>   WARNING: Port is blocked
>   java.net.BindException: Address already in use
> at java.base/sun.nio.ch.Net.bind0(Native Method)
> at java.base/sun.nio.ch.Net.bind(Net.java:555)
> at java.base/sun.nio.ch.Net.bind(Net.java:544)
> at java.base/sun.nio.ch.NioSocketImpl.bind(NioSocketImpl.java:643)
> at java.base/java.net.ServerSocket.bind(ServerSocket.java:388)
> at java.base/java.net.ServerSocket.(ServerSocket.java:274)
> at 
> net.sf.jabref.logic.remote.server.RemoteListenerServer.(RemoteListenerServer.java:40)
> at 
> net.sf.jabref.logic.remote.server.RemoteListenerServerThread.(RemoteListenerServerThread.java:33)
> at 
> net.sf.jabref.logic.remote.server.RemoteListenerServerLifecycle.open(RemoteListenerServerLifecycle.java:41)
> at net.sf.jabref.JabRef.start(JabRef.java:137)
> at net.sf.jabref.JabRefMain.main(JabRefMain.java:8)
> 
>   Arguments passed on to running JabRef instance. Shutting down.
> 
> How do I know from this what port the java application tried to use?

The documentation is surprisingly poor, but it looks like 6050 is the
default:

https://github.com/JabRef/jabref/issues/2698
https://github.com/JabRef/jabref/issues/8653

-- 
Celejar



Re: locating blocked port

2023-01-31 Thread Casey Deccio



> On Jan 31, 2023, at 8:05 AM, Haines Brown  wrote:
> 
> I have an  application that refuses to start because  its port is 
> blocked. But I have difficulty knowing what port it is

I would try strace, which shows you all system calls being made.  In this case, 
it is probably bind() that is returning an error.

strace -e trace=%net java -jar /usr/local/share/JabRef/JabRef-3.2.jar

Or

strace -e trace=%net java -jar /usr/local/share/JabRef/JabRef-3.2.jar 2>&1 | 
grep bind

For example:

$ cat test.py 
#!/usr/bin/env python3

import socket
s = socket.socket()
try:
s.bind(('0.0.0.0', 56))
except:
pass
$ python3 test.py # doesn't print any output
$ strace -e trace=%net python3 test.py 2>&1 | grep bind
bind(3, {sa_family=AF_INET, sin_port=htons(56), sin_addr=inet_addr("0.0.0.0")}, 
16) = -1 EACCES (Permission denied)

The value of sin_port is what you are looking for.

> How do I know from this what port the java application tried to use?
> 
> I try:
> 
>  $ strings $(which jabref) | wc -l
>56
> 

strings might be helpful (maybe?), but in this case, you are piping it to wc 
-l, which is simply counting the number of printable character sequences that 
were found in jabref.  If that also happens to be the port number, then it is 
coincidental.

>  So I try:
> 
>$ sudo ss -pt state listening 'sport = :56'
>Recv-Q   Send-QLocal Address:Port   Peer Address:Port Process
> 
>  This seems a null return. Dores this mean jabref is not using port 
>  56?

Well, it tells you that nothing (including jabref) is listening on TCP port 56, 
but it won't tell you about why something *failed* to listen.  See strace above.

Casey


locating blocked port

2023-01-31 Thread Haines Brown
I have an  application that refuses to start because  its port is 
blocked. But I have difficulty knowing what port it is

   $ java -jar /usr/local/share/JabRef/JabRef-3.2.jar &
  [1] 4831
  haines@lenin:~$ Jan 31, 2023 8:36:39 AM  
net.sf.jabref.logic.remote.server.Remote
  ListenerServerLifecycle open
  WARNING: Port is blocked
  java.net.BindException: Address already in use
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Net.java:555)
at java.base/sun.nio.ch.Net.bind(Net.java:544)
at java.base/sun.nio.ch.NioSocketImpl.bind(NioSocketImpl.java:643)
at java.base/java.net.ServerSocket.bind(ServerSocket.java:388)
at java.base/java.net.ServerSocket.(ServerSocket.java:274)
at 
net.sf.jabref.logic.remote.server.RemoteListenerServer.(RemoteListenerServer.java:40)
at 
net.sf.jabref.logic.remote.server.RemoteListenerServerThread.(RemoteListenerServerThread.java:33)
at 
net.sf.jabref.logic.remote.server.RemoteListenerServerLifecycle.open(RemoteListenerServerLifecycle.java:41)
at net.sf.jabref.JabRef.start(JabRef.java:137)
at net.sf.jabref.JabRefMain.main(JabRefMain.java:8)

  Arguments passed on to running JabRef instance. Shutting down.

How do I know from this what port the java application tried to use?

I try:

  $ strings $(which jabref) | wc -l
56

  So I try:

$ sudo ss -pt state listening 'sport = :56'
Recv-Q   Send-QLocal Address:Port   Peer Address:Port Process

  This seems a null return. Dores this mean jabref is not using port 
  56?


-- 

 Haines Brown 
 /"\
 \ /  ASCII Ribbon Campaign
  Xagainst HTML e-mail 
 / \