Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid ref translation entry #8047

Open
GouthamGatla opened this issue Nov 21, 2024 · 4 comments
Open

Invalid ref translation entry #8047

GouthamGatla opened this issue Nov 21, 2024 · 4 comments

Comments

@GouthamGatla
Copy link

/home/runner/work/realm-js/realm-js/packages/realm/bindgen/vendor/realm-core/src/realm/alloc.hpp:565: [realm-core-14.13.1] Invalid ref translation entry [0, 78187493520, 844629504, 12]

@jedelbo jedelbo changed the title crash issue <backtrace not supported on this platform> Invalid ref translation entry Nov 21, 2024
@jedelbo
Copy link
Contributor

jedelbo commented Nov 21, 2024

@GouthamGatla do you experience this in your local development setup? Is it reproducible?

@GouthamGatla
Copy link
Author

This issue iam facing in local development setup and iam able to reproduce @jedelbo

@jedelbo
Copy link
Contributor

jedelbo commented Nov 21, 2024

Would you be able to share the realm file you are working on? I guess it is rather large?

@GouthamGatla
Copy link
Author

/* eslint-disable prettier/prettier */
import Realm from 'realm';

const surveyTaskSchema = {
name: 'survey_task',
primaryKey: 'id',
properties: {
id: 'string',
mobileNumber: 'string',
status: 'string',
product: 'string?',
productId: 'string?',
fieldSurveyNumber: 'string?',
policyNumber: 'string?',
applicationNumber: 'string?',
claimIntimationNumber: 'string?',
state: 'string?',
district: 'string?',
subDistrict: 'string?',
revenueCircle: 'string?',
grampanchayat: 'string?',
village: 'string?',
insuredFarmerName: 'string?',
farmerFatherName: 'string?',
farmerMobileNumber: 'string?',
farmerType: 'string?',
ownershipType: 'string?',
cropName: 'string?',
cropSownArea: 'string?',
insuredArea: 'string?',
surveyNumber: 'string?',
dateOfSowing: 'string?',
dateOfLoss: 'string?',
dateOfLossIntimation: 'string?',
surveyType: 'string?',
localisedCropStage: 'string?',
localisedCauseOfLoss: 'string?',
localisedOnFieldCropCondition: 'string?',
localisedAffectedArea: 'string?',
localisedLoss: 'string?',
localisedNameOfGovtOfficer: 'string?',
localisedDesignationOfGovtOfficer: 'string?',
localisedContactNumberOfGovtOfficer: 'string?',
localisedExpectedDateOfHarvest: 'string?',
localisedComments: 'string?',
postHarvestCropStage: 'string?',
postHarvestCauseOfLoss: 'string?',
postHarvestOnFieldCropCondition: 'string?',
postHarvestAffectedArea: 'string?',
postHarvestLoss: 'string?',
postHarvestNameOfGovtOfficer: 'string?',
postHarvestDesignationOfGovtOfficer: 'string?',
postHarvestContactNumberOfGovtOfficer: 'string?',
postHarvestExpectedDateOfHarvest: 'string?',
postHarvestComments: 'string?',
geoCoordinatedOfTheAffectedField: 'mixed?',
imageWithFarmerAndGovtOfficialsPhoto: 'mixed?',
entireFieldPhoto: 'mixed?',
lossAffectedAreaPhoto: 'mixed?',
lossAffectedPlantPhoto: 'mixed?',
neighbourFieldPhoto: 'mixed?',
farmerPhotoId: 'mixed?',
farmerKhasraOrSurveyCopyPhoto: 'mixed?',
famerBankPassBookPhoto: 'mixed?',
surveyClaimFormFilledAndSignedPhoto: 'mixed?',
fieldPolygonPhoto: 'mixed?',
photoOfFieldAlongWitFarmer: 'mixed?',
captureVideoOfAffectedArea: 'mixed?',
surveyorName: 'string?',
claimsTeamComments: 'string?',
surveyStatus: 'string?',
vendorName: 'string?',
surveyorID: 'string?',
vendorID: 'string?',
surveyorMobileNumber: 'string?',
villageLatitude: 'string?',
villageLongitude: 'string?',
submittedDate: 'string?',
draftDate: 'string?',
filledDate: 'string?',
farmerTab: 'bool',
eventTab: 'bool',
surveyTab: 'bool',
postSurveTab: 'bool',
MediaTab: 'bool',
},
};

const cropsSchema = {
name: 'crops',
primaryKey: 'product',
properties: {
product: 'string',
cropNames: 'mixed[]',
},
};

const perilsSchema = {
name: 'perils',
primaryKey: 'id',
properties: {
id: 'string',
perilList: 'string[]',
},
};

const realm = new Realm({
schema: [surveyTaskSchema, perilsSchema, cropsSchema],
});

const handleRealmTransaction = async (transactionFn: any) => {
try {
realm.write(async () => {
await transactionFn();
});
} catch (error) {
console.error('Realm transaction error:', error);
}
};

export const createCropsInRealm = (data: any) => {
handleRealmTransaction(() => {
realm.create('crops', data);
});
};

export const getCrops = (name: any) => {
try {
return realm.objects('crops').filtered(product == "${name}");
} catch (error) {
console.error('Error fetching crops:', error);
return [];
}
};

export const getAllCrops = () => {
try {
return realm.objects('crops');
} catch (error) {
console.error('Error fetching all crops:', error);
return [];
}
};

export const updateCrop = (productName: any, newCropNames: any) => {
handleRealmTransaction(() => {
const cropToUpdate = realm.objectForPrimaryKey('crops', productName);
if (cropToUpdate) {
cropToUpdate.cropNames = newCropNames;
} else {
console.log('Product not found');
}
});
};

export const deleteAllCrops = () => {
handleRealmTransaction(() => {
const allCrops = realm.objects('crops');
realm.delete(allCrops);
});
};

export const deleteSingleCrop = (name: any) => {
handleRealmTransaction(() => {
const productToDelete = realm.objectForPrimaryKey('crops', name);
if (productToDelete) {
realm.delete(productToDelete);
} else {
console.log('Product not found');
}
});
};

export const deleteCropsByName = (cropName: any) => {
handleRealmTransaction(() => {
const productToDelete = realm.objectForPrimaryKey('crops', cropName);
if (productToDelete) {
realm.delete(productToDelete);
}
});
};

export const createPerilsInRealm = (data: any) => {
handleRealmTransaction(() => {
realm.create('perils', data);
});
};

export const getRealmPerils = () => {
try {
return realm.objects('perils');
} catch (error) {
console.error('Error fetching perils:', error);
return [];
}
};

export const createTask = async (data: any) => {
await handleRealmTransaction(() => {
realm.create('survey_task', data);
});
};

export const getSingleTask = (id: any) => {
try {
return realm.objects('survey_task').filtered('id == $0', id);
} catch (error) {
console.error('Error fetching single task:', error);
return [];
}
};

export const updateTask = async (id: any, newData: any) => {
await handleRealmTransaction(() => {
const task = realm.objectForPrimaryKey('survey_task', id);
if (task) {
Object.keys(newData).forEach(key => {
task[key] = newData[key];
});
}
});
};

export const deleteAllTheTasks = () => {
handleRealmTransaction(() => {
const allSurveyTasks = realm.objects('survey_task');
realm.delete(allSurveyTasks);
});
};

export const getAllValues = () => {
try {
return realm.objects('survey_task').filtered(status != "Synchronised");
} catch (error) {
console.error('Error fetching all values:', error);
return [];
}
};

export const getValuesByStatus = (statusValue: any) => {
try {
const query = status == "${statusValue}";
return realm.objects('survey_task').filtered(query);
} catch (error) {
console.error('Error fetching values by status:', error);
return [];
}
};

export const deleteSingleTask = (id: any) => {
handleRealmTransaction(() => {
const taskToDelete = realm.objectForPrimaryKey('survey_task', id);
if (taskToDelete) {
realm.delete(taskToDelete);
} else {
console.log('Task not found');
}
});
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants