Навигация

Итоги года

Другие ссылки


Реклама

Счётчики


<- Предыдущие записи

SonarQube would not start

18.04.2019 Четверг 18:43

Context:
- Windows 10
- SonarQube 7.7
- Java:
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)

Have been installing SonarQube. Faced an issue where SonarQube wouldn't start. I.e. StartSonar.bat would exit without reporting a meaningful error. It was just listing several processes that were terminating without giving a reason. The first process to terminate was "web". Found the web's process' log here:

[SONARQUBE HOME DIR]\logs\web.log

It contained a more useful error message:

2019.04.18 18:22:49 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
org.elasticsearch.cluster.block.ClusterBlockException: blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];
at org.elasticsearch.cluster.block.ClusterBlocks.indexBlockedException(ClusterBlocks.java:183)
at org.elasticsearch.action.support.replication.TransportReplicationAction.blockExceptions(TransportReplicationAction.java:255)
at org.elasticsearch.action.support.replication.TransportReplicationAction.access$500(TransportReplicationAction.java:100)
at org.elasticsearch.action.support.replication.TransportReplicationAction$ReroutePhase.doRun(TransportReplicationAction.java:780)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at org.elasticsearch.action.support.replication.TransportReplicationAction.doExecute(TransportReplicationAction.java:172)
at org.elasticsearch.action.support.replication.TransportReplicationAction.doExecute(TransportReplicationAction.java:100)
at org.elasticsearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:167)
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:139)
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:81)
at org.elasticsearch.action.bulk.TransportBulkAction$BulkOperation.doRun(TransportBulkAction.java:420)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at org.elasticsearch.action.bulk.TransportBulkAction.executeBulk(TransportBulkAction.java:533)
at org.elasticsearch.action.bulk.TransportBulkAction.executeIngestAndBulk(TransportBulkAction.java:271)
at org.elasticsearch.action.bulk.TransportBulkAction.doExecute(TransportBulkAction.java:222)
at org.elasticsearch.action.bulk.TransportBulkAction.doExecute(TransportBulkAction.java:90)
at org.elasticsearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:167)
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:139)
at org.elasticsearch.action.bulk.TransportSingleItemBulkWriteAction.doExecute(TransportSingleItemBulkWriteAction.java:69)
at org.elasticsearch.action.bulk.TransportSingleItemBulkWriteAction.doExecute(TransportSingleItemBulkWriteAction.java:44)
at org.elasticsearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:167)
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:139)
at org.elasticsearch.action.support.replication.TransportReplicationAction$OperationTransportHandler.messageReceived(TransportReplicationAction.java:284)
at org.elasticsearch.action.support.replication.TransportReplicationAction$OperationTransportHandler.messageReceived(TransportReplicationAction.java:276)
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:66)
at org.elasticsearch.transport.TcpTransport$RequestHandler.doRun(TcpTransport.java:1289)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at org.elasticsearch.common.util.concurrent.EsExecutors$1.execute(EsExecutors.java:140)
at org.elasticsearch.transport.TcpTransport.handleRequest(TcpTransport.java:1247)
at org.elasticsearch.transport.TcpTransport.messageReceived(TcpTransport.java:1111)
at org.elasticsearch.transport.TcpTransport.inboundMessage(TcpTransport.java:914)
at org.elasticsearch.transport.netty4.Netty4MessageChannelHandler.channelRead(Netty4MessageChannelHandler.java:53)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:323)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:297)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:241)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:656)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:556)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:510)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:470)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:909)
at java.lang.Thread.run(Unknown Source)

Googling revealed that the most likely cause of it is lack of disk space for the Elasticseach engine used by SonarQube. However, simply cleaning up more space (I increased available space from 7GB to 80GB) was not enough. I had to also remove this folder:

[SONARQUBE HOME DIR>]\data\es6

After removing this folder and restarting SonarQube, it started fine. The es6 directory got re-created.

The reason for this behavior seems to be that, when Elasticsearch detects there is not enough disk space, it marks 'indexes' as R/O and this somehow gets remembered in the es6 directory. So even after cleaning up space, the 'indexes' are still R/O.

Доктор, меня все игнорируют (нет комментариев)

TypeScript vs. C#: LINQ

19.04.2018 Четверг 22:41

Nice summary of Typescript equivalents of C#'s LINQ functions:

https://decembersoft.com/posts/typescript-vs-csharp-linq/

Доктор, меня все игнорируют (нет комментариев)

PowerShell and latest .NET

20.01.2015 Вторник 00:04

To force PowerShell use latest .NET Framework:

reg add hklm\software\microsoft\.netframework /v OnlyUseLatestCLR /t REG_DWORD /d 1
reg add hklm\software\wow6432node\microsoft\.netframework /v OnlyUseLatestCLR /t REG_DWORD /d 1

To find out what .NET version PowerShell is currently using, type this:

$PSVersionTable

Доктор, меня все игнорируют (нет комментариев)

SQL Server instances list

20.01.2015 Вторник 00:02

To see the list of SQL Server instances installed on the machine, use registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL

If you are looking for 32 bit instances on a 64 bit OS, you will need to look here:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\Instance Names\SQL

via blogs.msdn.com

Комментариев: 7

Implicit dependencies

13.06.2013 Четверг 18:36

When you work on a C# solution, sometimes it's quite easy to find dependencies between parts of the solution. For example, to find all uses of a class, in Visual Studio you just have to right-click on its name and select "Find all references". But sometimes dependencies and relationships are not that easy to find. Here i decided to list cases which may require special attention when you are refactoring your code and don't want to introduce breaking changes. This is based on my personal work experience.

1.Unity framework may introduce implicit dependencies. Once I was investigating a class and was trying to locate the place in the code where constructor of the class was being called. However, the Find all references feature did not yield ANY results. Which puzzled me much, because I knew the class WAS working and therefore its constructor had to be called somewhere. It turned out eventually that the constructor, even though it wasn't parameterless, was being called implicitly by the Unity framework. This was made possible by registering all types used as parameters of the constructor with Unity prior to use of the class.

So, if you use Unity (or may be some other IoCC), check if types of all parameters of the constructor are registered with Unity. If this is the case, the constructor might be called implicitly from inside the Unity framework.

2.Consider the scenario where you are refactoring your code by simply renaming classes, methods or properties. You are pretty sure you have accounted for all places where those names are used. Otherwise the project would simply not build, right? Wrong. A class may be used in a serialization/deserialization procedures when communicating with external parties, e.g. in WCF or RESTful service scenarios. In this case, the solution WILL compile, but at runtime you will get an error (or even worse, silent bug) when your code tries to deserialize a message received from an external party where they did not do the matching renamings.

So, when you rename anything, make sure it is not used in serialization/deserialization. If it's not, you are free to rename. If it is, you'll have to coordinate your refactoring with the party or perties that send you or receive from you serialized messages.

I will be adding more things like these here as soon as I discover or get to know about them.

Доктор, меня все игнорируют (нет комментариев)

How to identify version of SQL Server

15.11.2010 Понедельник 15:03

How to identify version of SQL Server:

SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')
via http://support.microsoft.com/kb/321185

Доктор, меня все игнорируют (нет комментариев)

OPENROWSET fails to import some data from Excel file

15.04.2010 Четверг 16:09

Context: SQL Server 2008, Excel 2007

When importing Excel data into SQL Server using OPENROWSET, if a column has 'mixed' data, i.e. it contains both numeric AND text values, not of all of that data may make it to the SQL Server. The reason lies in how the database driver works. It uses first several rows of the Excel file to determine type of values in columns. It then uses the infered type to import all values. BUT. If while importing it encounters a value that can be resolved to a different type, the driver just returns NULL for that value! Which gets inserted into the table in SQL Server.

To remedy this there are two things that need to be done:

1.Put "IMEX=1" into the provider string. This option tell to handle columns with mixed content (numeric and text) always as text.

The query should look like this:

SELECT * FROM OPENROWSET
('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\Fee_matrix.xls;IMEX=1;',
'SELECT * FROM [tProduct$]')
2.Set the following value in the system registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel\TypeGuessRows = 0

This setting determines exactly how many rows at the beginning of the Excel file does the driver consider to determine the type of the values in the column. Zero means "use ALL rows". Be aware that this may affect performance if your Excel file is big.

P.S. Also, the OPENROWSET queries may not work right away. The following may help:

- Open SQL Server Mgmt Studio
- Right-click the server
- Facets
- Facet: Surface Area Configuration
- AdHocRemoteQueriesEnabled: True
- Ok your way out of the dialogs

Доктор, меня все игнорируют (нет комментариев)

SQL 2008 Management Studio -> SQL 2005 instance issue

30.12.2009 Среда 13:00

When you connect to to a SQL Server 2005 instance using SQL Server 2008 Management Studio you may get an error about some permissions being lacked for a database when you're trying to enumerate databases. Here's a workaround:

1. Navigate to 'Databases' in OE and open OED in that context
2. Right click on the column header and unselect 'Collation'
3. Refresh the server in OE and enumerate the databases

(C)opied from here.

Glossary:
OE — Object Explorer
OED - Object Explorer Details (invoked View -> Object Explorer Details or just by F7)

Доктор, меня все игнорируют (нет комментариев)

SecurityAction

12.10.2009 Понедельник 19:05

Context: .Net Framework 2.0

Meaning of the members of the System.Security.Permissions.Security.Action enumeration:

RequestMinimum

Means "I need this permission". Application does not start if the assembly does not have the specified permission.

RequestOptional

Means"I don't need any permissions other than this one". Application starts and runs, but whenever a permission other than the specified one is requsted, an exception is thrown.

RequestRefuse

Means "I don't need this permission". Application starts and runs, but whenever the specified permission is requested, an exception is thrown.

Доктор, меня все игнорируют (нет комментариев)
<- Предыдущие записи