AttributeError: module ‘subprocess’ has no attribute ‘checkplatform’ when installing emsdk / Binaryen

AttributeError: module ‘subprocess’ has no attribute ‘checkplatform’ when installing emsdk / Binaryen

You will see this weird error when you are trying to follow the developer guide to install emsdk or using emsdk to install Binaryen support since I was using Mac to build things.

Command :  ./emsdk install –build=Release sdk-incoming-64bit binaryen-master-64bit
Error:
AttributeError: module ‘subprocess’ has no attribute ‘checkplatform’

Looks like this has to do with the python versions installed on your systems which get invoked by the emsdk execute file. Looks like the python dependencies being used by emsdk were missing a few attributes in a class.

Try adding python in the front to use the exact python version that you would like to use.

python ./emsdk install –build=Release sdk-incoming-64bit binaryen-master-64bit

Windows IRQL_NOT_LESS_OR_EQUAL BSOD error

Windows IRQL_NOT_LESS_OR_EQUAL BSOD error

There have been in many times in recent past, my laptop just decided to say – Dude.! Here enjoy the blue screen what everybody is dead scared off..!!

And always the error was IRQL_NOT_LESS_OR_EQUAL. Went through the couple of forums and understood that this comes primarily because of two reasons

1.  The physical disk space running out. Typically Windows works well with >15% free disk space.

2. Corrupt installation of drivers and malfunctioning of newly added hardware.

In my case it just kept keeping me puzzled as neither had I installed anything extra nor was my machine running out of disk space.

But then I saw something that made me look for the probably cause. 

Saw some posts complaining for VPN softwares creating issues and my colleague warned me about  the same. I was using Forticlient and it seems Forticlient has some issues on when being used with a wireless and on an x64 Windows machine. So I just stopped the services for Forticlient and voila..!! Problem solved..!!

Kudos to guys who chanced on this and made efforts to make a note of it. So I am just passing on what they did and what helped me..

Maven “No versions are present in the repository for the artifact with a range” error

Maven “No versions are present in the repository for the artifact with a range” error

There might be a good chance that on a beautiful Monday morning when you decide to build out a project, it just fails giving an error 

“No versions are present in the repository for the artifact with a range”

This is a wierd error when sometimes you end up sratching your head as the next line that follows this could be 

“org.springframework:spring-aop:jar:null”.

Not much of information.

But the catch is to look at where this stuff is being called from. For that have a look in the last 2-3 lines of the error stack trace. That is the place where you might see the list of dependencies. Or in short, artifacts that may be referring this.

In my case there were couple of culprits, the most of the times it being jersey. 

You would need to go the pom file of the dependency in the .m2 folder and look for the place where it says about the range. Typically you might see something like

 

 <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-aop</artifactId>
      <version>[2.5, 2.3)</version>
   </dependency>
Look at the version range. The best solution is to have a proper range. Or else correct the version to  the one that you have for the dependency in your repo.

That solves your problem..!! You can go back to enjoy the sunny day.

But on a side note, there have been also concerns about this being a bug in maven. If the above approach does not work, try upgrading the maven version as well. Have read it some forums but have not experience it though.

SSL Certificate Not Getting Updated in Apache

SSL Certificate Not Getting Updated in Apache

Our server certificates were about to expire and we had already received our renewed certificate. It was a simple task.

Go to httpd.conf.

Go to the virtual host section and just replace the following with the paths to the new certificate.

SSLCertificateFile /xxx/cert/www_domain_com.crt

SSLCertificateKeyFile /xxx/cert/privateKey.key

SSLCertificateChainFile /xxx/cert/cert_bundle.crt

But then came the shock. After hitting the url from the browser, we went to check the certificate information. That led us to see that still the old certificate was getting served. 

We started debugging to see what went wrong. We googled as well and loads of possible issues came out:

1. There could be something else sitting in front of your Apache say Plesk or nginx etc. BTW nginx is similar to Apache but more lightweight and fast. It is used sometimes as performance enhancer by making it serve content and sending the rest to Apache or any other back end. So in that case you might miss installing the certificates here.

2.The actual conf file may be different. This can be a cause if the last time the conf file was touched was long ago. Please doubly make sure that you are editing the correct .conf file.

3. Proper restart of Apache is needed. Apache does cache SSL certificates. But if a proper restart is done that is flushed out.

4. Worst, the browser may be caching the certificates. Please check the SSL settings in the browser to make sure that it is cleared. Modern day browsers are smarter though.

Unfortunately none of these seemed to be true in our case. Ultimately after 3-4 hours of struggle, we just thought that it could be a virtual host issue. We had number of virtual hosts lying. A wild guess—what if one was overwriting the other’s certificates?

Wierd guess though..we decided to change first and the last one. That shall mean that the first or the last whichever is the final overlap, shall have the latest certificate. But that also did not work.

Finally we decided to give a last shot and we changed all the virtual hosts with the above changes, even to the unused ones.

And Voila…!!! IT worked..!!

Strangely Apache seems to be retaining the old certificate even if one virtual host pointed to the old one, even if its an unused one. Right now I am digging into this to see why its so. Will post back if I get some info. 

Hope it helps,

Segmentation fault in Java (SIGSEGV)

Segmentation fault in Java (SIGSEGV)

We had some major issues when we had to use a native library by a third party.

We were seeing segmentation faults mainly the dreaded SIGSEGV. This would lead to OS signalling to kill the thread / process.

There can be multiple reasons for segmentation fault. In case of native calls it can be null pointers in native code or some incorrect memory access leading to killing of the thread. The bad part is this can be handled anywhere as the entire process killed. It would be interesting if there can be a way that the Java thread remains alive while native thread is killed. Just hypothetically thinking.

We solved it by switching the jdk to the Sun’s version instead of OpenJdk. The problem is solved but I am trying to understand what could have gone wrong. So if you are seeing segmentation fault please check the natives libraries or switch to Sun Jdk. There are loads of other reasons but these two seem to be main culprits always. I am continuing my research on this anyways to understand why Open Jdk crashed while Sun’s still works. Irony is I know the exact line of code where it happens. There is a malloc but why it works with Sun and crashes with Open Jdk needs to be found out.

Install ADB drivers for Android if OEM drivers not working / not present

Install ADB drivers for Android if OEM drivers not working / not present

These are the excertps I got from the site http://www.topnotchtablets.com/installADBdriver.

Used their instructions to load ADB drivers for Sony Xperia Tipo dual so that I could do debugging.

Install from the following links based on whether yours is a 32 or 64 bit Windows.

http://www.topnotchtablets.com/files/PDAnet-32bit.zip

http://www.topnotchtablets.com/files/PDAnet-64bit.zip

Go ahead and install the driver setup once downloaded.

Then simply navigate to Computer –> Device Manager –> Unrecognized android device. Update the driver and choose the browse option to point to the installation directory of the downloaded driver. Windows shall drive deep into the folder and install the software for you.

That’s it..Now your device is recognized as an Android device and also reachable via adb. Fire a adb devices command to confirm.

Hope it helps,

Windows 7 restarting automatically? Long live event logs.

Windows 7 restarting automatically? Long live event logs.

Is your windows OS restarting automatically?

This post shall be useful in case if this problem started after you started using an airtel  3G modem. It happens that on an airtel installation, there is an update service that gets installed and started. In my case it was the culprit.

The trick to find out the root cause for frequent reboots is the event log. You can find the event log in the control panel. You can just type “log” in the search window on the right and the first result takes you to the logs.

Image

Click on view event log. Then navigate to Windows Logs > System. After clicking on the system, just  wait as the logs load up. Browse through and search for winlogon in the source. Just below that or may be couple of rows below that you shall find the reasons for the restart. Look for some more occurrences of winlogon and if the same reasons precede it, then you have just nailed the culprit.

In my case it was the update service being triggered by the airtel/huwaei modem. It seems the same live update service is used for other manufactures also ending up in clashes. So just went to windows+R –> msconfig –> Services tab and disabled the airtel .OUC service. And that’s it.

Event log..someone thought of logging and made our lives easier. We too log loads of stuff. Its important to find issues in our applications. But its critical to know what to and how much to log. Else even logging can turn out to be a menace.

More on logging may be in the next blog..

PooledConnectionManager in HttpClient and Dead Locks

PooledConnectionManager in HttpClient and Dead Locks

We had a really a wierd issue once. We were making some http calls to third party site to get some information. During peak loads suddenly all the transactions were going slow. And some started to timeout.

The code was working as always for several month. No major changes to infrastructure as well. And no patches to the application server. Neither the logs were showing any errors. Such situations you end up on guessing as to what is going without having an inkling about the actual issue as there is not trace of anything going wrong.

We decided to step into the code and debug it out.We were amazed to find that that the issue lay in the Pooled Connection manager which was being injected into the HttpClient. It seems there was a deadlock inside when the algorithm runs to allocate connections from the pool.

Image

Another point that we started pondering that we had a clear timeout set on the http client as well. Why wasnt that coming into play? The reason it seems is all the timeouts are ignored when the locks happen in the native code. We faced this issue in version 4.2 for http client.

The intermediate solution was to create new connections. And the final solution was to maintain a pool of our own and have an algorithm take care of allocating from and returning back to the pool.

Run java application as CRON job in Linux

Run java application as CRON job in Linux

On many occasions there arises a need for having cron jobs running for us.These scheduled jobs help to perform some tasks regularly. Linux gives the capability of scheduling the jobs in variety of manner. That itself is a good subject to write on.

But for now lets take a look on how we can have standalone java applications run as cron jobs. It sometimes happens that we feel the need to run some java applications regularly for some purpose. Lets say I want to have jobs running some utility in concurrence to the actual application.

Lets say the application is bundled as Abc.jar.

To edit the cron job list, fire the following command

crontab -e


This opens up the cron job screen.

Here you need to add the java job. Lets say you want to run the app at 23:59 hours every night. The add

59 23 * * * /usr/local/jdk1.6_29/bin/java -jar /home/preet/Abc.jar > /home/preet/result.txt

Please note sometimes you need to add the fully qualified path for java as in some cases the cron might not have access to environment variables causing the job to fail. For eg the environment variables not being defined etc.

In case if you have any standard output the same should be visible in the result.txt file as above. I have just redirected the output in the above example to make sure that the result can be verified.

Another option is having a shell script and including the above command inside it. The script need to be made executable,of course..!

Hope it helps,

Mobile Broadband / 3G dongle not showing up in Ubuntu

Mobile Broadband / 3G dongle not showing up in Ubuntu

I installed  fresh Ubuntu 12.10 64 bit to make the system a dual boot with Windows 7. On booting up, I looked in the network manager so that I could get connected via the 3G modem. The so called “Mobile Broadband ” option was not available.

Stuck with no option and having tried out of lots of stuff and I rebooted the system into Windows to browse the internet and had to continue doing that until I found a solution.
The solution is really simple. It seems the Ubuntu was recognizing the dongle as a USB device and not as a modem. For this simply fire the command :
lsusb
You should see an output as below:
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 004: ID 0e0f:0008 VMware, Inc.When you plug in your device you shall see one more line with the name of your dongle manufacturer. The red highlighed is the vendor id and right is the product id.
Just in case if the name of vendor does not show up, please plug off the modem and fire the lsusb command. And then plugin the modem and fire the same command. The additional row should be the one for your modem.!
To make the modem active fire the command below.(Of course you need to know the sudo password..!!)

sudo modprobe usbserial vendor=0x0e0f  product =0x0008 

Wait for 5-10 seconds, your mobile broadband should be enabled and along with that you should be able to see your carried details on the same board.

Hope  this helps,