Rejoin the cluster after restart embedded vertx application - playframework-2.2

I have an embedded vertx application under play 2.2. After I restart the play app, the embedded won't join back to the cluster again. I can only see this message from vertx command line application but not joining as a member.
[192.168.133.141]:5701 [dev] 39999 accepted socket connection from /192.168.133.141:5702

It turns out I didn't set the cluster.xml correctly in the play embedded vertx. I made a repo to demo the play embedded vertx and vertx instance. Feel free to test and report bugs.
https://github.com/peer-im/vertx-cluster-with-play

Related

Virtual machine and kernel communication using netlink

I wrote a linux kernel module and a user space application. They had been communicating very well via netlink. But I got errno 111 (connection refused) when I was trying to run the user space application on an emulated node in CORE (Common Open Research Emulator). Could you help me find the cause (according to CORE, an emulated node is a virtual machine, which uses the same kernel as the local host)?
Thanks a lot!
The reason why I got "connection refused" error is because the user-land and kernel-land processes were not residing in the same network space. The kernel-land process was listening in the "root" space, while the user-land process was sending in another space.
CORE uses Linux virtualization. It creates separate process and network spaces for each emulated node. If an application is running on a CORE node, its user-land process has its own process-ID space and network stack space. The messages sent by the application were confined within the CORE node's own spaces.
To enable kernel-land and user-land communication when CORE is used, we should let the application switch to the kernel's network space first, and then create a netlink socket and send messages over the socket.
To switch to the kernel's network space, we need first mount /proc to /proc_root. And then, in the application, add {fd = open("/proc_root/1/ns/net", O_RDONLY); setns(fd, 0);} before sending messages to the kernel-land process using Netlink.
My guess is that it happened because of lack of linux capabilities (CAP_NET_ADMIN). Did you check capabilities of your user space process and your VM process?

IIS 8.5 new suspend option

I configured Windows 2012R2 with IIS 8.5 and turned on the new suspend option.
According to the documentation the state is written to disk and resources freed up.
I have a site that is strong on SignalR, when the site is started there is always a never-exiting thread that keeps track of parameters of a game, users come to the site, play the game and the state is saved in the database.
Before when the site terminated it would load everything from database to restore the game-state, which worked fine but it took a REAL long time before the site would start (sometimes up to 5 minutes).
Now I configured the suspend option and it looks to work fine, site starts up in matter of seconds, BUT the never-ending thread.. has ended.
What could be the culprit? Is there an event that is called when the site goes into suspend or comes out of suspend instead of a cold startup?
It's not a good idea to run background threads within IIS. See http://haacked.com/archive/2011/10/16/the-dangers-of-implementing-recurring-background-tasks-in-asp-net.aspx/
Possible solution is to have a Windows Service (I recommend TopShelf for easy bootstrap) that runs your background operations and communicates with your ASP.NET via API.
See this question: IIS Background thread and SignalR

Rails Remote Development Server iPad/Laptop Demos

I have a Rails application running on a remote Linux desktop at work via localhost. I wanted to be able to do live demos when I'm away from my desktop for business meetings and such without going through the hassle of pushing to my production server. I was wondering if anybody knew of a way to perhaps remotely connect to my desktop and run my Rails application on another device as if it was running locally? The remote device in question could be something like an iPad or net-book.
My application is sitting on a Github repository if it counts for anything, with that in mind would it be easier to just get rails up and running on an iPad and download the repository?
I'm not sure if safari on the ipad would support it, but for the netbook scenario I think proxying through an ssh tunnel would probably work best (I'm assuming you don't want to deal with the lag involved with a graphical remote desktop connection).
You could also deploy to an alternate environment like heroku or temporarily provision a publicly accessible VM somewhere for demo purposes.

jvisualvm doesn't list certain Java processes

I want to get a heap dump (suspected memory leak) of a certain Java process. However, when I start the jvisualvm tool, I cannot see any of the running Java processes.
I have Google'd around about this and have already found a couple of articles saying that you have to run the Java processes using the same JDK that you start the jvisualvm tool with in order for it to be able to see them. However, as far as I can see, this is already the case. I'm doing everything locally (I have remote access to the machine).
A couple of things to consider:
The processes are running on a firewalled Windows 2008 server
The processes are running using renamed versions of the JDK java.exe executable
As far as I can see the processes are running using the 1.6.0_18 JDK
One of the running processes starts an RMI registry
I'm waiting on a virtualized copy of the server so I can mess around with it (this is a production server). But in the meanwhile; any ideas as to why I cannot see any of the processes in jvisualvm (or jconsole for that matter)?
Well after I did a little research, it would appear that Peter's comment was correct. Because the JVM processes were launched by another user (the NETWORK SERVICE account because they were being started by a Windows service) they didn't show up in jvisualvm.
Workaround
Since I have access to the application configuration, I have found the following workaround, which involves explicitly enabling unsecured JMX for the target JVM:
Add the following JVM parameters:
-Dcom.sun.management.jmxremote.port=3333 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
Add the remote process to jvisualvm using JMX by click File -> Add JMX Connection. You can connect to the process using port 3333. Obviously you can change the port if you want.
Link to article explaining this in a little more detail: http://download.oracle.com/javase/6/docs/technotes/guides/visualvm/jmx_connections.html
Notes
It's probably not a good idea to keep the JVM settings permanently, as they would allow anyone to connect to the JVM via JMX.
You can also add authentication to the JMX JVM parameters if you want to.
The simplest way is to execute jvisualvm as administrator (win: "run as administrator"). Which is not ideal but works. All java processes are visible then.

Getting notified when a VPN connection disconnects

How can I, within my Cocoa app, get a notification when the currently running VPN connection disconnects? I'm running Snow Leopard.
You may be able to use the System Configuration framework for this. You can examine the System Configuration hierarchy with scutil(8), and you might have a look at HardwareGrowler's source code for examples of how to use the framework.
Also, documentation:
http://developer.apple.com/mac/library/documentation/Networking/Conceptual/SystemConfigFrameworks/
http://developer.apple.com/mac/library/documentation/Networking/Reference/SysConfig/