Please help, h2 console in El Capitan very very slow!!!

457 views
Skip to first unread message

SkiAddict

unread,
Dec 12, 2016, 11:37:31 PM12/12/16
to H2 Database
Earlier this year I moved to El Capitan. Ever since I've been finding the h2 console very very slow. Here are timings taken a few days ago with no other apps running:
  • 2 min 5 sec: Launch the console and wait for it to finish loading. Uses a shell script which does the following:
cd "/Applications/h2 1.3.167/bin"
java
-cp h2-1.3.167.jar org.h2.tools.Server
  • 2 min 48 sec: Click on the console's Connect button in my browser and wait for the database to be opened and the console to be ready to work
  • 2 min 20 sec: Run a very simple query which the DB engine takes 18ms to process
  • 21 sec: Click on the console's disconnect button and wait to be back at the console's "front page"
I don't believe this has anything to do with my browser or its addins/extensions, since the slowness starts right back in the Terminal.  It used to be that the messages about starting up the TCP and PG and Web servers flashed up on my Terminal window really fast, and then my browser came out.  Now it takes something like a half minute until the first message shows, then the other two probably take about 20-30 seconds each also.

As can be seen above, I'm running h2 version 1.3.167; the other day I tried using 1.3.176 but it was equally slow and gave me an error once the database was finally opened.  I will eventually upgrade to 1.3.176 but right now my priority is getting the console back into usable state.

Running java -version in my Terminal gives the following result:
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

The machine is currently on 10.11.6.  No antivirus software, and all other apps work just as usual while this slowness is happening.  Even other webpages load as quickly as usual.  It's just the console code which is being affected.

My Java app, which uses the same database as used in the timing run above, is also running just as fast as usual.

Please can some kind soul help me fix this?  I like h2 but this is driving me nuts.

SkiAddict

unread,
Dec 17, 2016, 12:09:52 AM12/17/16
to H2 Database
I did some trials today.  Unfortunately none of them made any difference to the slowness, but I'm mentioning them here in case they trigger something for someone.  I really need to solve this!  The console is essentially useless to me in its current state.

I tried:
  • Setting the Mac's Security & Privacy preferences to allow apps downloaded from Anywhere, in case the gatekeeper was poking its nose in.
  • Booting in Safe Mode, to check whether any of my extensions were causing problems.
  • Turning off SIP, just for the hell of it.
In all cases no other apps were running.  And as mentioned above, launching the console took just as long as detailed in my first post.  I didn't bother trying to connect to the database or do the SELECT statement.

One thing I did notice is that there is about a half minute from the time I start executing my shell script to the time when org.h2.tools.Server seems to be launched ("Server" appears on the menu bar).  Does this make anyone think of something I could try?

I'd love to see what happens running the console under Java 6, but I can't figure out how to go back to 6.  It's on my system, and I can see it in the Java Preferences application, but changes don't seem to 'stick': when I relaunch Java Preferences, 1.8 is again at the top and selected:

1. Launch Java Preferences then turn 1.8 off.



2.  Close the Java Preferences window.



3.  Relaunch Java Preferences and see this:


Any and all help gratefully received, I'm getting pretty desperate here.


Noel Grandin

unread,
Dec 17, 2016, 1:53:17 AM12/17/16
to h2-da...@googlegroups.com
you could try running things like wireshark to watch the tcp stream, and dtruss to watch the networking system calls.
Look for any long gaps between calls, or particularly long times for the call to complete.

Noel Grandin

unread,
Dec 17, 2016, 1:59:05 AM12/17/16
to h2-da...@googlegroups.com
you can also try setting the system property
   java.net.preferIPv4Stack=true

this all sounds like either
(a) a DNS lookup issue
(b) some kind of IP6/IP4 issue

SkiAddict

unread,
Dec 17, 2016, 2:42:59 AM12/17/16
to H2 Database
Thanks so much for your reply Noel :-)

- I'm sorry, but can you please explain how to set a system property?  I've googled java.net.preferIPv4Stack and all I see is Java code, calls to System.setProperty().  Also how do I get the current value of java.net.preferIPv4Stack -- perhaps it's already true???

- I've downloaded wireshark just now and I've got a capture of launching the console.  There are 25 gaps of 3 or 4 seconds (mostly 3 seconds) between lines -- I've never done network analysis before so I don't know if this (3s / 4s) is a long time, I'm assuming Yes.  I've saved the file so can send in the (assuming unlikely) event you want to see it.  There's a huge number of things called "Standard query 0x0000 <hard disk name>.local, "QU" [or "QM"] question AAA <hard disk name>" and then the text goes off the screen and I haven't figured out a way to see the rest of it.  Many of the 3s / 4s gaps are between lines like this.


Noel Grandin

unread,
Dec 17, 2016, 3:44:34 AM12/17/16
to h2-da...@googlegroups.com
On 17 December 2016 at 09:42, SkiAddict <skiad...@gmail.com> wrote:

- I'm sorry, but can you please explain how to set a system property?  I've googled java.net.preferIPv4Stack and all I see is Java code, calls to System.setProperty().  Also how do I get the current value of java.net.preferIPv4Stack -- perhaps it's already true???


add 
    -Djava.net.preferIPv4Stack=true
to the h2.sh file after the "java" command

- I've downloaded wireshark just now and I've got a capture of launching the console.  There are 25 gaps of 3 or 4 seconds (mostly 3 seconds) between lines -- I've never done network analysis before so I don't know if this (3s / 4s) is a long time, I'm assuming Yes.  I've saved the file so can send in the (assuming unlikely) event you want to see it.  There's a huge number of things called "Standard query 0x0000 <hard disk name>.local, "QU" [or "QM"] question AAA <hard disk name>" and then the text goes off the screen and I haven't figured out a way to see the rest of it.  Many of the 3s / 4s gaps are between lines like this.



you could post a screenshot here to look at  

And I just noticed that you're running a really old version.
You should probably try the latest 1.4 release, and add MV_STORE=false to your URL if you need to keep on using old databases.

SkiAddict

unread,
Dec 17, 2016, 4:43:39 PM12/17/16
to H2 Database
On Saturday, 17 December 2016 21:44:34 UTC+13, Noel Grandin wrote:

On 17 December 2016 at 09:42, SkiAddict <skiad...@gmail.com> wrote:

- I'm sorry, but can you please explain how to set a system property?  I've googled java.net.preferIPv4Stack and all I see is Java code, calls to System.setProperty().  Also how do I get the current value of java.net.preferIPv4Stack -- perhaps it's already true???

add 
    -Djava.net.preferIPv4Stack=true
to the h2.sh file after the "java" command

OK, thanks :-)

I've downloaded 1.4.193 and am using the h2.sh file in the bin folder to launch the console now.  I see that it calls org.h2.tools.Console, whereas my script file calls org.h2.tools.Server.  I don't know where I got my script from -- I certainly didn't write it.  Perhaps back in 2010 the h2.sh file called Server?  In any case the timings are now different, but still very slow.  Instead of just over 2 seconds to launch the console it takes 1m35s.

Changing the preferIPv4Stack property makes matters worse -- launching takes 1m50s.
 
- I've downloaded wireshark just now and I've got a capture of launching the console.  There are 25 gaps of 3 or 4 seconds (mostly 3 seconds) between lines -- I've never done network analysis before so I don't know if this (3s / 4s) is a long time, I'm assuming Yes.  I've saved the file so can send in the (assuming unlikely) event you want to see it.  There's a huge number of things called "Standard query 0x0000 <hard disk name>.local, "QU" [or "QM"] question AAA <hard disk name>" and then the text goes off the screen and I haven't figured out a way to see the rest of it.  Many of the 3s / 4s gaps are between lines like this.

you could post a screenshot here to look at  

OK, here goes.  This is of launching 1.4.193, without the change to preferIPv4Stack.  Wireshark is the only other app running at launch time (not even browser or the Terminal).  The timeline is as follows:
  • 0s launch h2.sh
  • 23s "Console" appears in my menu bar
  • 31s browser launched
  • 1m25s console finished loading in browser tab
The first two screenshots show the time up to 31s and the third one shows the end of the entire process.  The redactions are simply my name.  I removed the two bottom panes since they only show information for the selected row, and it enabled me to show more rows in each shot.  I also tried to show as much information on each row.
 





 






 
And I just noticed that you're running a really old version.
You should probably try the latest 1.4 release, and add MV_STORE=false to your URL if you need to keep on using old databases.

I prefer not to use beta versions, but did try 1.3.176, and found it just as slow as 1.3.167, and in addition it gave me an error when it finally finished opening my database.  So I figured I'd stick with 1.3.167 while fixing this slowness.   But I'll certainly use 1.4.193 at least for the moment.

Thanks again, Noel.  I do appreciate your help.

SkiAddict

unread,
Dec 17, 2016, 5:06:23 PM12/17/16
to H2 Database
More information: I finally managed to discover how to select Java 6 for my runtime, and launched 1.3.167 under it.  Launched in a few seconds start to finish.  Wireshark shows none of the "Standard query 0x0000..." rows which are such in evidence in the capture under 1.8.  Another difference: the Mac asked me whether I wanted Java to accept incoming network connections (I did nothing with the dialog box until the console had finished launching) whereas launching under 1.8 has never caused that dialog to appear.

Noel Grandin

unread,
Dec 18, 2016, 1:19:21 AM12/18/16
to h2-da...@googlegroups.com
Nice work so far, thanks.

Hmmm, ok, so this has something to do with Bonjour/MDNS and Java1.8.

Could you perhaps use VisualVM or jstack to capture a stacktrace of what the Console java process is doing during that gap between the browser launching and the console finishing loading?

Those tools on my mac are hiding in 
    /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home

SkiAddict

unread,
Dec 18, 2016, 4:29:44 PM12/18/16
to H2 Database
On Sunday, 18 December 2016 19:19:21 UTC+13, Noel Grandin wrote:
Nice work so far, thanks.

I'm glad I'm managing to do what you need :-)


Once again I'm in unchartered territory, so I hope I did right!  I waited until Console showed in my menu bar, then I ran jps in the Terminal, got the PID of Console (8502), and then once the browser tab started loading I went jstack -l 8502.  The tab was still loading.  Here's what it gave me:

2016-12-19 10:26:49
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.101-b13 mixed mode):

"Attach Listener" #18 daemon prio=9 os_prio=31 tid=0x00007fcc198f7000 nid=0xd813 waiting on condition [0x0000000000000000]
   java
.lang.Thread.State: RUNNABLE

   
Locked ownable synchronizers:
   
- None

"H2 Console thread" #15 prio=5 os_prio=31 tid=0x00007fcc1a2ac800 nid=0x5a13 waiting for monitor entry [0x00007000013d8000]
   java
.lang.Thread.State: BLOCKED (on object monitor)
    at java
.net.InetAddress.getLocalHost(InetAddress.java:1486)
   
- waiting to lock <0x0000000795802000> (a java.lang.Object)
    at org
.h2.util.NetUtils.isLocalAddress(NetUtils.java:218)
    at org
.h2.server.web.WebThread.allow(WebThread.java:344)
    at org
.h2.server.web.WebThread.getAllowedFile(WebThread.java:74)
    at org
.h2.server.web.WebThread.process(WebThread.java:120)
    at org
.h2.server.web.WebThread.run(WebThread.java:89)
    at java
.lang.Thread.run(Thread.java:745)

   
Locked ownable synchronizers:
   
- None

"Java2D Disposer" #13 daemon prio=10 os_prio=31 tid=0x00007fcc19bd3800 nid=0xce1b in Object.wait() [0x00007000012d5000]
   java
.lang.Thread.State: WAITING (on object monitor)
    at java
.lang.Object.wait(Native Method)
   
- waiting on <0x0000000795b054e8> (a java.lang.ref.ReferenceQueue$Lock)
    at java
.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
   
- locked <0x0000000795b054e8> (a java.lang.ref.ReferenceQueue$Lock)
    at java
.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
    at sun
.java2d.Disposer.run(Disposer.java:148)
    at java
.lang.Thread.run(Thread.java:745)

   
Locked ownable synchronizers:
   
- None

"Java2D Queue Flusher" #12 daemon prio=10 os_prio=31 tid=0x00007fcc1a1fd800 nid=0xc307 in Object.wait() [0x00007000011d2000]
   java
.lang.Thread.State: TIMED_WAITING (on object monitor)
    at java
.lang.Object.wait(Native Method)
   
- waiting on <0x0000000795b02110> (a sun.java2d.opengl.OGLRenderQueue$QueueFlusher)
    at sun
.java2d.opengl.OGLRenderQueue$QueueFlusher.run(OGLRenderQueue.java:203)
   
- locked <0x0000000795b02110> (a sun.java2d.opengl.OGLRenderQueue$QueueFlusher)

   
Locked ownable synchronizers:
   
- None

"AWT-Shutdown" #11 prio=5 os_prio=31 tid=0x00007fcc19ad0000 nid=0x7417 in Object.wait() [0x000070000104c000]
   java
.lang.Thread.State: WAITING (on object monitor)
    at java
.lang.Object.wait(Native Method)
   
- waiting on <0x0000000795b5b708> (a java.lang.Object)
    at java
.lang.Object.wait(Object.java:502)
    at sun
.awt.AWTAutoShutdown.run(AWTAutoShutdown.java:295)
   
- locked <0x0000000795b5b708> (a java.lang.Object)
    at java
.lang.Thread.run(Thread.java:745)

   
Locked ownable synchronizers:
   
- None

"AppKit Thread" #10 daemon prio=5 os_prio=31 tid=0x00007fcc19948800 nid=0x200f runnable [0x0000000000000000]
   java
.lang.Thread.State: RUNNABLE

   
Locked ownable synchronizers:
   
- None

"H2 Console Server (http://192.168.1.52:8082)" #8 prio=5 os_prio=31 tid=0x00007fcc1a0c4800 nid=0x100b runnable [0x000070000082b000]
   java
.lang.Thread.State: RUNNABLE
    at java
.net.PlainSocketImpl.socketAccept(Native Method)
    at java
.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409)
    at java
.net.ServerSocket.implAccept(ServerSocket.java:545)
    at java
.net.ServerSocket.accept(ServerSocket.java:513)
    at org
.h2.server.web.WebServer.listen(WebServer.java:352)
    at org
.h2.tools.Server.run(Server.java:578)
    at java
.lang.Thread.run(Thread.java:745)

   
Locked ownable synchronizers:
   
- None

"Service Thread" #7 daemon prio=9 os_prio=31 tid=0x00007fcc1a05b000 nid=0x4403 runnable [0x0000000000000000]
   java
.lang.Thread.State: RUNNABLE

   
Locked ownable synchronizers:
   
- None

"C1 CompilerThread1" #6 daemon prio=9 os_prio=31 tid=0x00007fcc19866800 nid=0x4203 waiting on condition [0x0000000000000000]
   java
.lang.Thread.State: RUNNABLE

   
Locked ownable synchronizers:
   
- None

"C2 CompilerThread0" #5 daemon prio=9 os_prio=31 tid=0x00007fcc1983b800 nid=0x4003 waiting on condition [0x0000000000000000]
   java
.lang.Thread.State: RUNNABLE

   
Locked ownable synchronizers:
   
- None

"Signal Dispatcher" #4 daemon prio=9 os_prio=31 tid=0x00007fcc1983a800 nid=0x3e0f runnable [0x0000000000000000]
   java
.lang.Thread.State: RUNNABLE

   
Locked ownable synchronizers:
   
- None

"Finalizer" #3 daemon prio=8 os_prio=31 tid=0x00007fcc19821000 nid=0x2e03 in Object.wait() [0x0000700000728000]
   java
.lang.Thread.State: WAITING (on object monitor)
    at java
.lang.Object.wait(Native Method)
   
- waiting on <0x0000000795588ee0> (a java.lang.ref.ReferenceQueue$Lock)
    at java
.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
   
- locked <0x0000000795588ee0> (a java.lang.ref.ReferenceQueue$Lock)
    at java
.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
    at java
.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)

   
Locked ownable synchronizers:
   
- None

"Reference Handler" #2 daemon prio=10 os_prio=31 tid=0x00007fcc1a01f000 nid=0x2c03 in Object.wait() [0x0000700000625000]
   java
.lang.Thread.State: WAITING (on object monitor)
    at java
.lang.Object.wait(Native Method)
   
- waiting on <0x0000000795586b50> (a java.lang.ref.Reference$Lock)
    at java
.lang.Object.wait(Object.java:502)
    at java
.lang.ref.Reference.tryHandlePending(Reference.java:191)
   
- locked <0x0000000795586b50> (a java.lang.ref.Reference$Lock)
    at java
.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)

   
Locked ownable synchronizers:
   
- None

"main" #1 prio=5 os_prio=31 tid=0x00007fcc1a005800 nid=0x907 runnable [0x0000700000219000]
   java
.lang.Thread.State: RUNNABLE
    at java
.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    at java
.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
    at java
.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
    at java
.net.InetAddress.getLocalHost(InetAddress.java:1500)
   
- locked <0x0000000795802000> (a java.lang.Object)
    at org
.h2.util.NetUtils.getLocalAddress(NetUtils.java:271)
   
- locked <0x00000007957ff450> (a java.lang.Class for org.h2.util.NetUtils)
    at org
.h2.server.TcpServer.getURL(TcpServer.java:198)
    at org
.h2.tools.Server.start(Server.java:485)
    at org
.h2.tools.Console.runTool(Console.java:265)
    at org
.h2.tools.Console.main(Console.java:99)

   
Locked ownable synchronizers:
   
- None

"VM Thread" os_prio=31 tid=0x00007fcc1a005000 nid=0x2a03 runnable

"GC task thread#0 (ParallelGC)" os_prio=31 tid=0x00007fcc1a009800 nid=0x2603 runnable

"GC task thread#1 (ParallelGC)" os_prio=31 tid=0x00007fcc1a00a000 nid=0x2803 runnable

"VM Periodic Task Thread" os_prio=31 tid=0x00007fcc1986f800 nid=0x4603 waiting on condition

JNI
global references: 418


Thanks once again, Noel :-)

Noel Grandin

unread,
Dec 19, 2016, 1:04:39 AM12/19/16
to h2-da...@googlegroups.com
ok, so it's hanging in the 
     at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
    at java
.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
    at java
.net.InetAddress.getLocalHost(InetAddress.java:1500)
    
- locked <0x0000000795802000> (a java.lang.Object)
    at org
.h2.util.NetUtils.getLocalAddress(NetUtils.java:271)
    
- locked <0x00000007957ff450> (a java.lang.Class for org.h2.util.NetUtils)
    at org
.h2.server.TcpServer.getURL(TcpServer.java:198)
    at org
.h2.tools.Server.start(Server.java:485)
    at org
.h2.tools.Console.runTool(Console.java:265)
    at org
.h2.tools.Console.main(Console.java:99)

part.


​Some googling around doesn't find anything particularly interesting other than this:

Do either of those help?

SkiAddict

unread,
Dec 19, 2016, 2:59:57 PM12/19/16
to H2 Database
 

Yes, and no.

No in the sense that simply editing etc/hosts didn't help (even after a restart).  I found https://github.com/thoeni/inetTester and ran the binary; interestingly, although my etc/hosts now reads like this:

127.0.0.1    localhost santas-macbook-pro-2.local
255.255.255.255    broadcasthost
::1             localhost santas-macbook-pro-2.local
fe80
::1%lo0    localhost

the result is

Method called, hostname Santa's MacBook Pro.local, elapsed time: 5150 (ms)

(notice the capitalisation and the lack of a "2" at the end)  I am wondering I'm suffering some sort of caching problem, so will step through the source today and see what I can see.


Yes in the sense that this is now in Java territory (albeit stuff I've never mucked with before) so I may be able to get the rest of the way on my own.


I'll keep you posted, and thank you so much for getting me this far!!

Tomas Pospichal

unread,
Dec 19, 2016, 5:35:49 PM12/19/16
to H2 Database
 
I have seen slow local network connections from Java on other platforms, but with H2 it seems to be OSX or mac OS users who are running into it.
Similar problems have been discussed here last month: H2 database running really slow on mac OS sierra https://groups.google.com/d/msg/h2-database/H-oSOO7Lwn4/Pm5eY0WTBwAJ   Although the problem got resolved by a simple addition to the hosts file, it is not quite clear what were all the things at play there and whether your situation is the same.

In your case, you may want to first try to set the local host name explicitly to something simple (no spaces, apostrophes or other non-traditional characters), rather than relying on your system to somehow automatically convert computer name to a legal network hostname. (The full computer name can be kept as is, for use in the UI).

I am not sure why you try to add "-2" at the end of the presumed hostname in your hosts file, the queries in your TCP captures do not show anything like that.

Finally, if you had no luck seeing any effect from modifications to /etc/hosts: on newer macs the file is apparently shadowed by /private/etc/hosts

Regards,
Tomas

SkiAddict

unread,
Dec 19, 2016, 6:37:32 PM12/19/16
to H2 Database
On Tuesday, 20 December 2016 11:35:49 UTC+13, Tomas Pospichal wrote:
 
I have seen slow local network connections from Java on other platforms, but with H2 it seems to be OSX or mac OS users who are running into it.
Similar problems have been discussed here last month: H2 database running really slow on mac OS sierra https://groups.google.com/d/msg/h2-database/H-oSOO7Lwn4/Pm5eY0WTBwAJ   Although the problem got resolved by a simple addition to the hosts file, it is not quite clear what were all the things at play there and whether your situation is the same.

Certainly, changing the file doesn't appear to have made any difference.  However, I still need to confirm whether caching is having an effect here i.e. whether my changes are actually being paid attention to.
 
In your case, you may want to first try to set the local host name explicitly to something simple (no spaces, apostrophes or other non-traditional characters), rather than relying on your system to somehow automatically convert computer name to a legal network hostname. (The full computer name can be kept as is, for use in the UI).

OK, I just set it to "trial.local" (by clicking Edit in the Sharing preference pane).  etc/hosts now reads

127.0.0.1    localhost trial.local
255.255.255.255    broadcasthost
::1             localhost trial.local
fe80
::1%lo0    localhost

And no improvement in speed....  But, again, maybe the system isn't even privy to those changes.
 
I am not sure why you try to add "-2" at the end of the presumed hostname in your hosts file, the queries in your TCP captures do not show anything like that.

Well, I did it because that's what the Sharing preference pane said was my local host name -- I found it a little strange, but that's what it said, so I used it.
 
Finally, if you had no luck seeing any effect from modifications to /etc/hosts: on newer macs the file is apparently shadowed by /private/etc/hosts

Yeah, I was being a bit lazy in typing etc/hosts.  In fact etc is just an alias on my system, to private/etc.  So it was in fact private/etc/hosts which I was editing.
 
Thanks for the ideas, Tomas.  Any others gratefully received! :-)

SkiAddict

unread,
Dec 19, 2016, 6:59:39 PM12/19/16
to H2 Database
Actually, I spoke too soon.  I decided to run Wireshark again and see what it said.  Launching the h2 console now only takes 58s as opposed to the 1m25s of previously.  Still too slow, but an improvement.  (The reason I originally said there was no improvement is that unless I'm doing something like a trace, these days I don't bother waiting for the console to grind its way to completion: if it doesn't finish launching in a matter of seconds I quit it.)

Two differences that I can see in the Wireshark trace:
1)  There are none of the "Standard query 0x0000..." rows.
2)  There are no packets at all added to the window until the point where "Console" appears in my menu bar.  This is after 22s -- so, essentially the same time-lag as previously.  But there is (apparently) no network activity now during the lag.     ?????

OTOH, I am still having the same local hostname resolution problem.  Running the inetTester still produces a result of just over 5s.

SkiAddict

unread,
Dec 19, 2016, 8:13:15 PM12/19/16
to H2 Database
Curiouser and curioser...

Both the local host and the computer name are now "trial", and the hard disk name is now "tt", so there are no remnants of "Santa's MacBook" anywhere AFAICS.  I've run OnyX to clean the system caches (boot, kernel and extensions, CUPS jobs (not related to this issue, but I thought why not), and "other system components") and restarted.

And the inetTester STILL returns "Santa's MacBook Pro.local" after the 5s time lag!!!

I'm wondering if perhaps there is a gremlin in that string, since in stepping through the library code starting at InetAddress.getLocalHost().getHostName(), the only place it lags is a call to StringCoding.encode() from String.getBytes(), which wants to encode "Santa's MacBook Pro.local" in UTF-8.  And it just so happens to lag for about 5s...

But how on earth do I get the string to actually reflect current reality????

Noel Grandin

unread,
Dec 20, 2016, 1:07:30 AM12/20/16
to h2-da...@googlegroups.com
On 20 December 2016 at 03:13, SkiAddict <skiad...@gmail.com> wrote:

I'm wondering if perhaps there is a gremlin in that string, since in stepping through the library code starting at InetAddress.getLocalHost().getHostName(), the only place it lags is a call to StringCoding.encode() from String.getBytes(), which wants to encode "Santa's MacBook Pro.local" in UTF-8.  And it just so happens to lag for about 5s...

No idea about why the name is still hanging around, but I don't think the JDK source code you have linked in your IDE is the right one - there is no way that particular call is the problem.
 

Noel Grandin

unread,
Dec 20, 2016, 1:08:09 AM12/20/16
to h2-da...@googlegroups.com

SkiAddict

unread,
Dec 20, 2016, 2:30:18 AM12/20/16
to H2 Database
On Tuesday, 20 December 2016 19:08:09 UTC+13, Noel Grandin wrote:

Grrrrr!  Nothing I do gets rid of the damn old hostname!!!  Did the above twice, restarted, did it again, restarted, and still all I get is Santa's MacBook Pro.local :-(

However, I did see this, partway down the comments in http://osxdaily.com/2012/08/07/edit-hosts-file-mac-os-x/:



I've tried to follow the instructions in https://tomafro.net/2009/07/dscl-the-easy-way-to-add-hosts-on-osx but once again I'm seriously out of my experience.  Does anyone understand how to work dscl?


Also, I know it's weird that it seems to be StringCoding.encode() that's causing the problem, but in the debugger there were none of the usual signs of a mismatch between compiled code lines and source lines.  And, I've just double-checked: the project sourcepath is from the 1.8.0_101-b13 JDK, and my JRE is 1.8.0_101-b13.

Auto Generated Inline Image 1

SkiAddict

unread,
Dec 20, 2016, 11:29:44 PM12/20/16
to H2 Database
Update: with the help of someone over at stackexchange I managed to get rid of "Santa's MacBook Pro", and inetTester now resolves in 77ms.  The key thing was setting HostName (not LocalHostName) to 'trial':

sudo scutil --set HostName trial

With this done, h2 console launches in seconds.  What a huge relief!

So, with everything working I did some investigation.  I really do think there was a gremlin in the original string "Santa's MacBook Pro", since by successive small changes I've managed to get back to it in HostName -- and h2 console still launches in seconds.  Space chars, apostrophe, no problems at all.  It also has nothing to do with the contents of etc/hosts -- I'm now using my original copy of that file.

Many, many thanks Noel and Tomas, I could not have resolved this without your help.  You've made "Santa" very happy -- and right before Christmas, too! :-)

Tomas Pospichal

unread,
Dec 22, 2016, 10:07:30 AM12/22/16
to H2 Database
I am very glad you persisted and found a simple solution. It may prove very useful to other Mac users whose system is in a similar configuration.

Regards,
Tomas

SkiAddict

unread,
Dec 22, 2016, 3:28:00 PM12/22/16
to H2 Database
On Friday, 23 December 2016 04:07:30 UTC+13, Tomas Pospichal wrote:
I am very glad you persisted and found a simple solution. It may prove very useful to other Mac users whose system is in a similar configuration.

Regards,
Tomas


Thanks, Tomas.  Since posting my update I have discovered persuasive evidence that the problem was a smart quote instead of an ordinary apostrophe.  WHY the Mac put it there I have no idea -- I certainly didn't.  It had never occurred to me that it was even possible to put a smart quote in the Sharing preference pane!!  But that does rather seem to be what happened......

Reply all
Reply to author
Forward
0 new messages