Mono 2.8.2 System.buffer.blockcopy error - apache

When testing a ubuntu server running apache2 and mono 2.8.2 in a high load environment, about every ten minutes, it would output the following error (with the last two error lines repeated about a hundred times afterwards).
Handling exception type ArgumentOutOfRangeException
Message is Non-negative number required.
Parameter name: srcOffset
IsTerminating is set to True
System.ArgumentOutOfRangeException: Non-negative number required.
Parameter name: srcOffset
at System.Buffer.BlockCopy (System.Array src, Int32 srcOffset, System.Array dst, Int32 dstOffset, Int32 count) [0x000b7] in /home/elliott/mono-2.8.2/mcs/class/corlib/System/Buffer.cs:103
at System.Net.WebConnectionStream.ReadAll () [0x00183] in /home/elliott/mono-2.8.2/mcs/class/System/System.Net/WebConnectionStream.cs:259
at System.Net.WebConnectionStream.CheckResponseInBuffer () [0x0002f] in /home/elliott/mono-2.8.2/mcs/class/System/System.Net/WebConnectionStream.cs:120
at (wrapper remoting-invoke-with-check) System.Net.WebConnectionStream:CheckResponseInBuffer ()
at System.Net.WebConnection.ReadDone (IAsyncResult result) [0x001a3] in /home/elliott/mono-2.8.2/mcs/class/System/System.Net/WebConnection.cs:476
at System.Net.Sockets.Socket+SocketAsyncResult.CB (System.Object unused) [0x00000] in /home/elliott/mono-2.8.2/mcs/class/System/System.Net.Sockets/Socket.cs:214
[Tue Mar 08 13:49:58 2011] [error] (70014)End of file found: read_data failed
[Tue Mar 08 13:49:58 2011] [error] Command stream corrupted, last command was 1
[Tue Mar 08 13:49:58 2011] [error] (70014)End of file found: read_data failed
[Tue Mar 08 13:49:58 2011] [error] Command stream corrupted, last command was 1
Would this be an issue with something in my code somewhere, or is it a problem in mod_mono itself? It seemed to appear after putting a higher load on the server, and there were no reference line numbers to any of my source code files.
Also to note, after upgrading to mono 2.10.1, in small tests I instead get this error with every request (but I haven't been able to test any large scale load):
[Mon Mar 14 12:59:30 2011] [error] (70014)End of file found: read_data failed
[Mon Mar 14 12:59:30 2011] [error] Command stream corrupted, last command was -1

That looks like a bug in System.Net.WebConnectionStream.ReadAll to me. Somehow I suspect that readBufferOffset has become negative, although it's not obvious how... (of course, this may have been fixed since 2.8.2...) The argument validation code for Buffer.BlockCopy is pretty straightforward...

I may have fixed this some time ago in a git pull which got committed to Mono on 2012-03-01. Unfortunately, this means it isn't in mono 2.10.8.1 (which many distros are currently at since mono 3 is still beta).

Related

Maximo automation script no module named socket

I'm developing an automation script and I'm getting the next error:
ImportError: No module named socket in at line number 2
I'm using jython 2.7, maximo 7.6.
Someone knows a workaround? I know that not every package is installed as it were in python and as it seems the socket pckg is one of the not installed...
I was able to view the Maximo contents of the Maximo jython.jar (or any .jar file) by executing the following command as administrator at the command prompt on a Windows server:
assoc .jar=CompressedFolder
With that I was able to locate and browse the Lib folder within the jython.jar on a Windows server Websphere implementation at the following location:
C:\IBM\WebSphere\AppServer\profiles\ctgAppSrv01\installedApps\ctgCell01\MAXIMO.ear\lib\jython.jar\Lib
The socket.py module exists there so it should be possible to use it from within Jython in Maximo. It appears to be a version specifically written for Jython and references the following in the .py file:
https://wiki.python.org/jython/NewSocketModule
In vanilla Maximo 7.6.0 it appears the Jython path does not include the Lib folder of the jython.jar referenced above. You can find details of how to add it to the path programmatically in an automation script here:
https://expertinmaximo.wordpress.com/2016/08/26/import-python-libraries-to-use-in-automation-scripts/
Once that is done you should be able to import the socket library and use it in your script for example:
from java.lang import System
import sys
# Required : Appending to sys.path to refer to python libraries
if sys.path.count('__pyclasspath__/Lib') == 1:
service.log('\nPath to /Lib already exists\n')
else :
service.log('\nExtend path to /Lib \n')
sys.path.append('__pyclasspath__/Lib')
import socket
try:
#create an AF_INET, STREAM socket (TCP)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
service.log('\nsocket created\n')
except socket.error, msg:
service.log('\nFailed to create socket. Error code: ' + str(msg[0]) + ' , Error message : ' + msg[1] + '\n')
Once that is executed you should see similar to the following in the log (provided autoscript logging is functioning):
07 Jun 2020 15:18:04:949 [DEBUG] putting System value <type 'java.lang.System'>
07 Jun 2020 15:18:04:949 [DEBUG] putting sys value <module 'sys' (built-in)>
07 Jun 2020 15:18:04:949 [DEBUG] getting sys
07 Jun 2020 15:18:04:949 [DEBUG] putting socket value <module 'socket' from '__pyclasspath__/Lib/socket.py'>
07 Jun 2020 15:18:04:949 [DEBUG] getting socket
07 Jun 2020 15:18:04:949 [DEBUG] getting socket
07 Jun 2020 15:18:04:949 [DEBUG] getting socket
07 Jun 2020 15:18:04:949 [DEBUG] putting s value <socket._socketobject object at 0x5>
07 Jun 2020 15:18:04:949 [DEBUG] execution completed for cached compiled script MXC_SOCKET for launch point MXC_SOCKET_LP
07 Jun 2020 15:18:04:949 [DEBUG] Path to /Lib already existssocket created
I suggest using Java libraries to do what you want. All of the Java libraries needed to build Maximo are waiting for your call. This will also reduce the risk of compatibility problems if you want to send data back to Maximo.
Today I ran into the same problem but solved it rather quickly using Java libraries instead of Python. Here's a function I wrote that returns all IP addresses of a host name as a set:
from java.net import InetAddress
def getIpAddress(hostName):
hostIpAddresses = set()
try:
service.log_debug("DNS querying the host name: " + hostName)
hosts = InetAddress.getAllByName(hostName)
for i in range(len(hosts)):
hostIpAddresses.add(str(hosts[i].getHostAddress()))
service.log_debug("Address found: " + str(hostIpAddresses))
return hostIpAddresses
except:
return "NOT FOUND"

Package 'jdk' isn't signed with proper key

can some one tell what below lines indicates. I am using tomcat7 its suddenly goes down after some time . i can see below log in /var/log/messages file. is jvm got crashed ?
Dec 28 17:39:06 track03 abrt[23595]: Saved core dump of pid 9849 (/usr/java/jdk1.6.0_27/bin/java) to /var/spool/abrt/ccpp-2016-12-28-17:38:14-9849 (12624896000 bytes)
Dec 28 17:39:06 track03 abrtd: Directory 'ccpp-2016-12-28-17:38:14-9849' creation detected
Dec 28 17:39:07 track03 abrtd: Package 'jdk' isn't signed with proper key
Dec 28 17:39:07 track03 abrtd: 'post-create' on '/var/spool/abrt/ccpp-2016-12-28-17:38:14-9849' exited with 1
Dec 28 17:39:07 track03 abrtd: Deleting problem directory '/var/spool/abrt/ccpp-2016-12-28-17:38:14-9849'
That means process /usr/java/jdk1.6.0_27/bin/java crashed and core dump was saved to directory /var/spool/abrt/ccpp-2016-12-28-17:38:14-9849. But abrtd daemon recognized that package jdk was not signed with GPG key so directory was deleted.
For some more information check:
ABRT logs messages with "Package isn't signed with proper key."
Red Hat Linux error - Package 'rmmagent' isn't signed with proper key
If you want to inspect core dumps you can change default behavior of abrtd in case of third-party packages:
Edit the file /etc/abrt/abrt-action-save-package-data.conf
Set OpenGPGCheck = no
Reload abrtd with the command: service abrtd reload

cobbler sync - generating dhcpd.template file

I am trying to resolve a cobbler issue, request your help/guidance on the same. we have spacewalk with cobbler. when I add a new host and do a cobbler sync, i am getting the below error and TASK FAILED.
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
Exception occured: <class 'cexceptions.CX'>
Exception value: 'Error templating file, check cobbler.log for more details'
when I cross check the cobbler.log, these entries were recorded...
Mon Apr 25 14:44:45 2016 - WARNING | errors were encountered rendering the template
Mon Apr 25 14:44:45 2016 - WARNING |
[{'code': u'VFFSL(SL,"net0",True)/mac',
'exc_val': NotFound("cannot find 'net0'",),
'lineCol': (2, 11),
'rawCode': u'${net0/mac}',
'time': 'Mon Apr 25 14:44:45 2016'}]
Thanks
Nandakumar
we found its was a profile with the system Profile with a wrong name, which was stopping creating the dhcpd.conf file. After removing the particular system profile, everything works well.
Thanks
Nandakumar

Running Jboss 7.1.1 on Fedora 20 as service

I have encountered a problem with running Jboss as service on Fedora. Here is the log I have after using command: systemctl status jboss-as.service
Here is the log I have been receiving:
jboss-as.service - SYSV: JBoss AS Standalone
Loaded: loaded (/etc/rc.d/init.d/jboss-as)
Active: failed (Result: resources) since Thu 2014-01-16 09:31:54 CET; 46min ago
Process: 501 ExecStart=/etc/rc.d/init.d/jboss-as start (code=exited, status=0/SUCCESS)
Jan 16 09:31:22 servername.domain systemd[1]: Starting SYSV: JBoss AS Standalone...
Jan 16 09:31:23 servername.domain jboss-as[501]: Starting jboss-as: chown: missing operand after ‘/var/run/jboss-as’
Jan 16 09:31:23 servername.domain jboss-as[501]: Try 'chown --help' for more information.
Jan 16 09:31:54 servername.domain jboss-as[501]: [ OK ]
Jan 16 09:31:54 servername.domain systemd[1]: PID file /var/run/jboss-as/jboss-as-standalone.pid not readable (yet?) after start.
Jan 16 09:31:54 servername.domain systemd[1]: Failed to start SYSV: JBoss AS Standalone.
Jan 16 09:31:54 servername.domain systemd[1]: Unit jboss-as.service entered failed state.
First, I tried to find a solution for the chown: missin operand after ... problem and found something: here but it did not help. And also, I was looking for the answer for the PID file problem but it does not even exist in in the location: var/run/jboss-as/
This is because the startup script uses the variable $JBOSS_USER but it is not defined inside the script.
Please put in the file /etc/jboss-as/jboss-as.conf the following line:
JBOSS_USER=root
(change the root with other dedicated linux user e.g. jboss-as)
It looks like the service startup script expects to be able to write to the /var/run/jboss-as directory but doesn't have permissions to do so.
In your place I'd ensure that this directory is owned by the user that runs JBoss and that it is writable.
Check that there aren't other errors (particularly missing or incorrect paths) in your /etc/rc.d/init.d/jboss-as file (I assume you copied it from the jboss install folder to create a startup script.
I had the same issue until I fixed a completely unrelated link in that script, then it went away.
In Centos 7, if you straight way copying the jboss-as-standalone.sh in /etc/rc.d/init.d/, ensure JBOSS_CONF and JBOSS_HOME path is correct.
For me, it was with systemd. When I set the service y put wrong the PID File.
Example:
In the service was like
/var/run/jboss-as/jboss-as-standalone.pid
But in the script was like
/var/run/jboss-as/jboss-as.pid

*.php unable to stat

Very strange errors in my apache log on a new server, obviously I have no *.php file.
[Mon Feb 18 08:02:32 2013] [error] [client ::1] script '/var/www/html/*.php' not found or unable to stat
Suggestions are welcome.
Unable to stat just means the file doesn't exist.
Check your code, and make sure there's no place trying to require this *.php. It's somewhat hard to debug without any actual code.