lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Warren Falk (JIRA)" <>
Subject [jira] [Commented] (LUCENENET-593) NullReferenceException in Linux
Date Fri, 11 Aug 2017 11:20:00 GMT


Warren Falk commented on LUCENENET-593:

I don't think that's quite it.  Simply installing that package appears to have no effect.

You can see that IndexWriter.SetDiagnostics() does the following:

diagnostics["os.arch"] = Constants.OS_ARCH;

And since Constants.OS_ARCH is this:

public static readonly string OS_ARCH = GetEnvironmentVariable("PROCESSOR_ARCHITECTURE", "x86");

...we will always get the value of the environment variable.  This _is_ the underlying OS's
architecture, so that's correct - but only in Windows.  (Except also in .Net Core, there's
this extra code in GetEnvironmentVariable()):

if (variable == "PROCESSOR_ARCHITECTURE") {
    return RuntimeInformation.OSArchitecture.ToString();

This has no effect on me because Mono is .Net Framework not .Net Standard (I am targeting
net452, not any netstandard).

But I think this block is what you're talking about.  If I remove the #if block, then install
that package to the dependencies in Lucene.Net.project.json, then the problem is resolved.
 So perhaps this is the resolution you are suggesting.  Let me know if this is a good solution
and I'll submit a PR

Keep in mind that this changes the actual stored value of the os_arch to X64 instead of AMD64
(for .Net Framework, it would already have been X64 in .Net Standard).
Also, the net451 version of Lucene.Net otherwise has no dependencies (this will be the first)...
if that matters.

> NullReferenceException in Linux
> -------------------------------
>                 Key: LUCENENET-593
>                 URL:
>             Project: Lucene.Net
>          Issue Type: Bug
>          Components: Lucene.Net Core
>    Affects Versions: Lucene.Net 4.8.0, Lucene.Net 5.0 PCL
>         Environment: Linux (ubuntu 64 bit, maybe all linux variants)
>            Reporter: Warren Falk
> A NullReferenceException on any attempt to query in Linux (ubuntu x64 in my tests)
> I was able to track this down to the following line in Constants.cs
>         {{public static readonly string OS_ARCH = GetEnvironmentVariable("PROCESSOR_ARCHITECTURE",
> Sure enough, PROCESSOR_ARCHITECTURE is not set by default in ubuntu server x64 and when
I set it, there is no failure.
> I would fix this, but I'm not sure what this value is used for, so I am not sure what
the appropriate behavior should be.  Should we try to find the correct architecture here?
 And what is the correct string, "amd64", "x64", "x86_64"?  Or do we really just want to know
the value of that if it is actually not set, should we leave it blank?  The issue is that
the InfoWriter can't write a null, but it could write an empty string.
> I'll submit a pull request if anyone can tell me what correct behavior should be.

This message was sent by Atlassian JIRA

View raw message